Counting unique combinations within dates

collo

New Member
Joined
Jan 2, 2018
Messages
5
[TABLE="width: 500"]
<tbody>[TR]
[TD]Public
[/TD]
[TD]1[/TD]
[TD]2017[/TD]
[/TR]
[TR]
[TD]Public[/TD]
[TD]2[/TD]
[TD]2018[/TD]
[/TR]
[TR]
[TD]Private[/TD]
[TD]3[/TD]
[TD]2017[/TD]
[/TR]
[TR]
[TD]Private[/TD]
[TD]3[/TD]
[TD]2018[/TD]
[/TR]
[TR]
[TD]Private[/TD]
[TD]4[/TD]
[TD]2018[/TD]
[/TR]
</tbody>[/TABLE]

So I'm trying to count the number of unique combinations of the first two columns, then according to the date.

I currently have:
{=SUM(--(FREQUENCY(IF($A:$A="Public",MATCH($B:$B,$B:$B,0)),ROW($B:$B)-ROW($B$1)+1)>0))}

Which will count the number of unique combinations, however I don't know how to incorporate the date parameter into this.
Possibly using SUMPRODUCT?
Something along the lines of:
{=SUMPRODUCT(--(FREQUENCY(IF($A:$A=$E11,MATCH($B:$B,$B:$B,0)),ROW($B:$B)-ROW($B$2)+1)>0)*(C:C=2018))}
It just comes out as #VALUE

Thanks in advance
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Maybe this array formula (enter with CTFL-SHIFT-ENTER):
Code:
=SUM(--(FREQUENCY(IF($A:$A="Public",IF($C:$C=2018,MATCH($B:$B,$B:$B,0))),ROW($B:$B)-ROW($B$1)+1)>0))
 
Upvote 0
Just a little extra since it's actually a date range I'm dealing with, not just a year.

Is there a good way to place an AND in the IF where the - $C:$C=2018 - is?
Can't seem to get it to work.

Thanks again
 
Upvote 0
Try this:
Code:
=SUM(--(FREQUENCY(IF(A:A="Public",IF(YEAR(C:C)=2018,MATCH(B:B,B:B,0))),ROW(B:B)-ROW($B$1)+1)>0))
 
Upvote 0
Apologies, I didn't explain that very well.

It needs to be within the tax year so needs two include results in a range between two dates.
FIX:
I've amended the original data to fit to a yearly basis, so yes the YEAR(C:C) works now.

If there is a better way to do it feel free.

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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