Unique count with another condition

not very bright dave

Board Regular
Joined
Dec 20, 2004
Messages
244
Hi all

I understand that the following can be used to generate the number of unqiue values in an array:

=SUMPRODUCT((A1:A20<>"")/(COUNTIF(A1:A20,A1:A20)+(A1:A20="")))

However, what if you want to count only the unique values that have another condition attached in another array (for example, in B1:B20 I have a list of names and I only want to know the numbber of unique items for 'John')?

This has been driving me crazy all morning and I've finally given up and decided to ask the experts!

Thanks for your help

Dave
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Try...

=SUM(IF(FREQUENCY(IF(B1:B20="John",IF(A1:A20<>"",MATCH("~"&A1:A20,A1:A20&"",0))),ROW(A1:A20)-ROW(A1)+1),1))

...confirmed with CONTROL+SHIFT+ENTER, not just ENTER.

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,216,070
Messages
6,128,614
Members
449,460
Latest member
jgharbawi

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