count unique values based on a value of "Yes" in another column

clagar1610

New Member
Joined
Nov 10, 2011
Messages
24
Need help trying to count unique values based on a value of "Yes" in another column?

In column E I have a list of cities, used the following formula to get a count of unique cities -

SUM(IF(FREQUENCY(MATCH(E$8:E$172,E$8:E$172,0),MATCH(E$8:E$172,E$8:E$172,0))>0,1))

But now I also want to only count the unique city if Column G has a value of "Yes".

Please help?
 
I would use a pivot table with filter on "Yes" and the use COUNTA-function to count the number of unique codes
k.r.
Piet
 
Upvote 0
Need help trying to count unique values based on a value of "Yes" in another column?

In column E I have a list of cities, used the following formula to get a count of unique cities -

SUM(IF(FREQUENCY(MATCH(E$8:E$172,E$8:E$172,0),MATCH(E$8:E$172,E$8:E$172,0))>0,1))

But now I also want to only count the unique city if Column G has a value of "Yes".

Please help?

Control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(FREQUENCY(IF(E$8:E$172<>"",IF(G$8:G$172="Yes", 
    MATCH("~"&E$8:E$172,E$8:E$172&"",0))),
      ROW(E$8:E$172)-ROW(E$8)+1),1))
 
Upvote 0
Another way:
=COUNT(1/FREQUENCY(IF($G$8:$G$172="YES",(MATCH($E$8:$E$172,$E$8:$E$172,0))),ROW($E$8:$E$172)-ROW(E8)+1))

array formula confirm with CTRL+SHIFT+ENTER
 
Upvote 0
Another way:
=COUNT(1/FREQUENCY(IF($G$8:$G$172="YES",(MATCH($E$8:$E$172,$E$8:$E$172,0))),ROW($E$8:$E$172)-ROW(E8)+1))

array formula confirm with CTRL+SHIFT+ENTER


I swear I'm putting in the same equation and doing CTRL+SHIFT+ENTER to get curly braces and it's not working . . . I'm at work so I'm using Excel 2003 and I'm not sure if something needs to be tweaked . . .
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top