title: Count unique values from columnA if adjacent columnB meets a criteria and is not equal to a second criteria
body: <p>This is my first post and hopefully I can explain this issue clearly.</p>
  
  <p>Assuming the following raw excel table:</p>
  
  <pre><code>ColumnA ColumnB ColumnC             
  1       W       A               
  1       E       A               
  1       W       B               
  1       E       C               
  1       E       D               
  1       E       E               
  1       W       E               
  1       E       F               
  
  
  Count of unique E in ColumnB    5               
  Count of unique W in ColumnB    3               
  </code></pre>
  
  <p>Task:</p>
  
  <p>1) In counting unique values in ColumnC, count unique values that have a value of E in ColumnB.</p>
  
  <p>2) In counting unique values in ColumnC, count unique values that have a value of W in ColumnB, taking into consideration that if an item in ColumnC has both E and W in ColumnB, it should only be counted for assumption 1 above.  Only items in ColumnC that have only W in ColumnB should be included in this count.</p>
  
  <p>As shown in my results, the count for items that have E in ColumnB is 5 which is correct. However, the count for items that have W in ColumnB is returning 3, but it should only return 1 because {1, W, B} is the only row where ColumnC item B has only a W in ColumnB.</p>
  
  <p>The excel formula I have used for both counts are below:</p>
  
  <p><strong>Count for E</strong></p>
  
  <pre><code>=SUM(IF(FREQUENCY(IF($A$2:$A$9="1",IF($B$2:$B$9="E",MATCH($C$2:$C$9,$C$2:$C$9,0))),ROW($C$2:$C$9)-ROW($C$2)+1),1))
  </code></pre>
  
  <p><strong>Count for W</strong></p>
  
  <pre><code>=SUM(IF(FREQUENCY(IF($A$2:$A$9="1",IF($B$2:$B$9="W",MATCH($C$2:$C$9,$C$2:$C$9,0))),ROW($C$2:$C$9)-ROW($C$2)+1),1))
  </code></pre>
  
  <p><strong>Note</strong> the formula needs to be entered with <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Enter</kbd></p>
  
  <p>How can I count for W and exclude rows from ColumnC that have both E and W in ColumnB?</p>
  
  <p>Thanks in advance.</p>