Counting Unique Values If Value in Another Column is True

DanielThal

New Member
Joined
Mar 25, 2015
Messages
2
I'm trying to find the sum of unique values in column A but only if the corresponding value in column C is 'true'.

Right now I can find the number of unique values in column A but can't seem to figure out how to make it only count certain cells.

I have:

=SUMPRODUCT((A4:A9999<>"")/COUNTIF(A4:A9999,A4:A9999&""))

which gives me the number of unique values in column A.

I have names in column C, let's say one is 'Bob' and ID codes in column A, some of which could be '15-12345' and '15-12346', etc (with duplicates)

How can I find the number of unique values in column A for when the name in column C is 'Bob'?

Can I just add SUMIF to the equation somehow?

Thank you for your help, I really appreciate it.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
=SUMPRODUCT(--(A4:A9<>""),--($C$4:$C$9="Bob")/COUNTIF(A4:A9,A4:A9&""))


I'm trying to find the sum of unique values in column A but only if the corresponding value in column C is 'true'.

Right now I can find the number of unique values in column A but can't seem to figure out how to make it only count certain cells.

I have:

=SUMPRODUCT((A4:A9999<>"")/COUNTIF(A4:A9999,A4:A9999&""))

which gives me the number of unique values in column A.

I have names in column C, let's say one is 'Bob' and ID codes in column A, some of which could be '15-12345' and '15-12346', etc (with duplicates)

How can I find the number of unique values in column A for when the name in column C is 'Bob'?

Can I just add SUMIF to the equation somehow?

Thank you for your help, I really appreciate it.
 
Upvote 0
I'm trying to find the sum of unique values in column A but only if the corresponding value in column C is 'true'.

Right now I can find the number of unique values in column A but can't seem to figure out how to make it only count certain cells.

I have:

=SUMPRODUCT((A4:A9999<>"")/COUNTIF(A4:A9999,A4:A9999&""))

which gives me the number of unique values in column A.

I have names in column C, let's say one is 'Bob' and ID codes in column A, some of which could be '15-12345' and '15-12346', etc (with duplicates)

How can I find the number of unique values in column A for when the name in column C is 'Bob'?

Can I just add SUMIF to the equation somehow?

Thank you for your help, I really appreciate it.

1) Control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(IF(A4:A9999<>"",IF(C4:C9999,MATCH(A4:A9999,A4:A9999,0))),ROW(A4:A9999)-ROW(A4)+1),1))

2) Control+shift+enter, not just enter:

=SUM(IF(FREQUENCY(IF(A4:A9999<>"",IF(C4:C9999="Bob",MATCH(A4:A9999,A4:A9999,0))),ROW(A4:A9999)-ROW(A4)+1),1))

http://www.mrexcel.com/forum/excel-questions/292473-performance-formulas-unique-count.html
 
Upvote 0
=SUMPRODUCT(--(A4:A9<>""),--($C$4:$C$9="Bob")/COUNTIF(A4:A9,A4:A9&""))

If you testing, this formula will give wrong result,

Try this :

=SUMPRODUCT((A4:A9<>"")*(C4:C9="Bob")/COUNTIFS(C4:C9,C4:C9,A4:A9,A4:A9&""))
 
Upvote 0
actually, this evaluates to #DIV/0!..

@daniel, use 2nd formula by Aladin, tried it and it worked..



If you testing, this formula will give wrong result,

Try this :

=SUMPRODUCT((A4:A9<>"")*(C4:C9="Bob")/COUNTIFS(C4:C9,C4:C9,A4:A9,A4:A9&""))
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,702
Members
449,048
Latest member
81jamesacct

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