counting unique cases which meet two conditions

The Grim Discovery

Board Regular
Joined
Jan 23, 2015
Messages
244
Office Version
  1. 365
Platform
  1. Windows
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]Team
[/TD]
[TD]Name
[/TD]
[TD]Rating
[/TD]
[TD]Man of Match
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]United
[/TD]
[TD]Smith
[/TD]
[TD]10
[/TD]
[TD]Yes
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]City
[/TD]
[TD]Brown
[/TD]
[TD]9
[/TD]
[TD]Yes
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]United
[/TD]
[TD]Robinson
[/TD]
[TD]10
[/TD]
[TD]Yes

[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5
[/TD]
[TD]United
[/TD]
[TD]Smith
[/TD]
[TD]10
[/TD]
[TD]Yes
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6
[/TD]
[TD]City
[/TD]
[TD]Brown
[/TD]
[TD]8
[/TD]
[TD]No
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7
[/TD]
[TD]United
[/TD]
[TD]Smith
[/TD]
[TD]9
[/TD]
[TD]yes
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Excel folk

Once again I turn to your wisdom in my hour of need.
The table above replicates the issue I'm having trying to count uniquely occurring instances.

For instance I need to be able to count the number of times that the team called 'United' (Col A) had a player who scored a rating of 10 (col C) & was also Man of the Match (col D). But I only want to count unique cases. So for United this should return a total of 2 as Smith and Robinson both meet those criteria (albeit Smith does twice).

I've recently had support here from user: Domenic on frequency syntax which has been invaluable to me but I cant stretch the logic to fit the case here. I've tried concatenating the data but it hasn't helped. It's the unique bit that does for me as the first part is evidently countifs.

Thanks in advance
 
Last edited:

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hello,

With your data located in range A1:D7

you could test following Array Formula

Code:
=SUM(IF(FREQUENCY(IF($B$2:$B$7<>"",IF($D$2:$D$7="Yes",IF($A$2:$A$7<="United",IF($C$2:$C$7=10,MATCH("~"&$B$2:$B$7,$B$2:$B$7&"",0))))),ROW($B$2:$B$7)-ROW($B$2)+1),1))

Hope this will help
 
Upvote 0
Cheers James - that absolutely nailed it. There's no way I'd ever have got there. Brilliant.
If you don't mind what's the tilde doing after the MATCH function - that's new to me?
 
Upvote 0
Actually James

I'm finding that the A2:A7 part of the formula appears to be ignoring the name ie. 'United' - thought I might be able to work this out myself. I was wrong...
 
Upvote 0
Hello,

Sorry for the typo ... you should remove the sign ' lower than ' and keep th equal sign ...

Code:
[COLOR=#333333]=SUM(IF(FREQUENCY(IF($B$2:$B$7<>"",IF($D$2:$D$7="Yes",IF($A$2:$A$7="United",IF($C$2:$C$7=10,MATCH("~"&$B$2:$B$7,$B$2:$B$7&"",0))))),ROW($B$2:$B$7)-ROW($B$2)+1),1))[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,108
Members
452,544
Latest member
aush

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