title: Excel Formula: Subtracting Total values if Price, Qty, and Part are equal to Price, Qty, and Part Range
body: <p>This is my first post. Please see the attached Photo. The items highlighted in yellow is the criteria I'm trying to create.</p>
  
  <p>I want to subtract the Extended Values (G-L) if the Buy is not optimal and the Price and Qty in cells columns D and F exist in the range of cells in columns J and K and the value in Column B = the value in Column R.</p>
  
  <p>Below is the formula that works for some of the cases, but not all.</p>
  
  <pre><code>=IFNA(IF(AND(H7="Optimal Buy",P7="",IFNA(MATCH(D7,X:X,0),0)&gt;0,IFNA(MATCH(F7,W:W,0),0)&gt;0),G7-L7,""),"")
  </code></pre>
  
  <p>Formula Question:
  <img src="https://i.stack.imgur.com/gJ0OM.png" alt="Formula Question"></p>