CSE formula to count unique instances

doug firr

Board Regular
Joined
Mar 28, 2011
Messages
140
Hello, I'm using a formula that I was kindly given once on this forum. It has served me well - I have cut n paste it many times and it has always worked till now.

It's an array formula (CSE).

SUM(IF(FREQUENCY(IF('all regs'!$C$10:$C$74865>=summary!$C$7,IF('all regs'!$C$10:$C$74865>=summary!$D$7,IF('all regs'!$D$10:$D$74865=summary!$B10,MATCH('all regs'!$Q$10:$Q$74865,'all regs'!$Q$10:$Q$74865,0)))),ROW('all regs'!$Q$10:$Q$74865)-ROW('all regs'!$Q$10)+1),1))​

What is says is filter down to within a date range (C7 and D7 are dates) and then filter down to match a text condition (B10 is a text string). Then count the unique records in the range Q10 - Q74,865 on the allregs tab.

By using auto filter and "remove duplicates" feature I know that I should have 3,413 unique observations but my formula returns 314.

I appreciate this may be a longshot without seeing the data - if anyone can see anything wrong with the formula do tell me!

Thanks for any feedback,
Doug.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Maybe...

=SUM(IF(FREQUENCY(IF('all regs'!$C$10:$C$74865>=summary!$C$7,IF('all regs'!$C$10:$C$74865<=summary!$D$7,IF('all regs'!$D$10:$D$74865=summary!$B10,MATCH('all regs'!$Q$10:$Q$74865,'all regs'!$Q$10:$Q$74865,0)))),ROW('all regs'!$Q$10:$Q$74865)-ROW('all regs'!$Q$10)+1),1))

Ctrl+Shift+Enter

M.
 
Upvote 0
Hello, I'm using a formula that I was kindly given once on this forum. It has served me well - I have cut n paste it many times and it has always worked till now.

It's an array formula (CSE).
SUM(IF(FREQUENCY(IF('all regs'!$C$10:$C$74865>=summary!$C$7,IF('all regs'!$C$10:$C$74865>=summary!$D$7,IF('all regs'!$D$10:$D$74865=summary!$B10,MATCH('all regs'!$Q$10:$Q$74865,'all regs'!$Q$10:$Q$74865,0)))),ROW('all regs'!$Q$10:$Q$74865)-ROW('all regs'!$Q$10)+1),1))​

What is says is filter down to within a date range (C7 and D7 are dates) and then filter down to match a text condition (B10 is a text string). Then count the unique records in the range Q10 - Q74,865 on the allregs tab.

By using auto filter and "remove duplicates" feature I know that I should have 3,413 unique observations but my formula returns 314.

I appreciate this may be a longshot without seeing the data - if anyone can see anything wrong with the formula do tell me!

Thanks for any feedback,
Doug.

The issue might be with the date conditions:

>=C7 vs <=D7

So, try:
=SUM(IF(FREQUENCY(IF('all regs'!$Q$10:$Q$74865<>"",IF('all regs'!$C$10:$C$74865>=summary!$C$7,IF('all regs'!$C$10:$C$74865<=summary!$D$7,IF('all regs'!$D$10:$D$74865=summary!$B10,MATCH('all regs'!$Q$10:$Q$74865,'all regs'!$Q$10:$Q$74865,0))))),ROW('all regs'!$Q$10:$Q$74865)-ROW('all regs'!$Q$10)+1),1))

Just a side note: HTML is the worst language ever invented.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,147
Messages
6,123,296
Members
449,095
Latest member
Chestertim

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