Count if AND then Unique

tra1a

Board Regular
Joined
Jul 31, 2011
Messages
85
I have three columns: A, B, C

I want to tally a unique record in column C as it relates to A and B.

example: Number of times Boat appears in column C if A is blue and B is fast.

Any thoughts?
 
This one might work...
=SUMPRODUCT(--(A:A="blue"),--(B:B="fast"),--(C:C="Boat"))
 
Upvote 0
Upvote 0
I have three columns: A, B, C

I want to tally a unique record in column C as it relates to A and B.

example: Number of times Boat appears in column C if A is blue and B is fast.

Any thoughts?
What version of Excel are you using?
 
Upvote 0
I have three columns: A, B, C

I want to tally a unique record in column C as it relates to A and B.

example: Number of times Boat appears in column C if A is blue and B is fast.

Any thoughts?

Vidar appears to assume a 2007 system or later. If thta is correct, we can also add a COUNTIFS formula to the arsenal next to Sumproduct and a pivot table:

=COUNTIFS(A:A,"blue",B:B,"fast",C:C,"Boat")
 
Last edited:
Upvote 0
Aladin Akyurek said:
Vidar appears to assume a 2007 system or later. If thta is correct, we can also add a COUNTIFS formula to the arsenal next to Sumproduct and a pivot table:

=SOUNTIFS(A:A,"blue",B:B,"fast",C:C,"Boat")
Looks like an error in your formula.
 
Upvote 0
I didn't explain correctly the first time. I agree about the pivot table, but it won't work for this purpose.

So if A is Blue and B is Fast, I need to know how many uniques are C
 
Upvote 0
I didn't explain correctly the first time. I agree about the pivot table, but it won't work for this purpose.

So if A is Blue and B is Fast, I need to know how many uniques are C
Try this array formula**:

=SUM(IF(FREQUENCY(IF(A2:A10="Blue",IF(B2:B10="Fast",MATCH(C2:C10,C2:C10,0))),ROW(C2:C10)-ROW(C2)+1),1))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
 
Upvote 0
I didn't explain correctly the first time. I agree about the pivot table, but it won't work for this purpose.

So if A is Blue and B is Fast, I need to know how many uniques are C

Control+shift+enter, not just enter:
Rich (BB code):
=SUM(IF(FREQUENCY(IF(C2:C400<>"",
  IF(A2:A400="Blue",IF(B2:B400="Fast",
   MATCH("~"&C2:C400,C2:C400&"",0)))),ROW(C2:C400)-ROW(C2)+1),1))

If there are no surrounding chars with special meaning like < around the target entries, the "~"& and &"" bits can be removed from the formula.
 
Last edited:
Upvote 0
Try this array formula**:

=SUM(IF(FREQUENCY(IF(A2:A10="Blue",IF(B2:B10="Fast",MATCH(C2:C10,C2:C10,0))),ROW(C2:C10)-ROW(C2)+1),1))

** array formulas need to be entered using the key
combination of CTRL,SHIFT,ENTER (not just ENTER).
Hold down both the CTRL key and the SHIFT key
then hit ENTER.
If the data in column C is numbers then we can use this shorter version:

=SUM(IF(FREQUENCY(IF(A2:A10="Blue",IF(B2:B10="Fast",C2:C10)),C2:C10),1))

Still array entered!
 
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