Count Unique Values Based on Unique (sort of) Criteria

Minx_Minxy

New Member
Joined
Jul 13, 2015
Messages
37
Office Version
  1. 365
Platform
  1. Windows
Apologies if this question has been raised before, I did look through the old posts but nothing that got close to an answer for me.

I need the count of how many times the ID occurs during a period. But I need to count them uniquely.

Here is an example of the data

DateID
22/07/20245239926
22/07/20245239926
22/07/20245129989
23/07/20245129989
24/07/20245239926
24/07/20245239926
24/07/20245245569
26/07/20245129989
27/07/20245245569


This is the formula I am using

=COUNTIFS([ID],A1,[Date],"<="&A2)

Where A1 = the ID I am filtering
and A2 = Today's date

It works fine for unique IDs such as 5129989, but for IDs that repeat during the day, like ID 5239926 , it gives me 4, but really I need it to give me 2.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
How about
Fluff.xlsm
ABCD
15239926DateID
202/08/202422/07/20245239926
3222/07/20245239926
422/07/20245129989
523/07/20245129989
624/07/20245239926
724/07/20245239926
824/07/20245245569
926/07/20245129989
1027/07/20245245569
Data
Cell Formulas
RangeFormula
A2A2=TODAY()
A3A3=ROWS(UNIQUE(FILTER(C2:C100,(D2:D100=A1)*(C2:C100<=A2))))
 
Upvote 1
Solution
how about
=COUNTA(UNIQUE(FILTER(B1:B9,(B1:B9<=A2)*(C1:C9=A1))))

Book11
ABCDE
152399267/22/2452399262
28/2/247/22/245239926
37/22/245129989
47/23/245129989
57/24/245239926
67/24/245239926
77/24/245245569
87/26/245129989
97/27/245245569
Sheet1
Cell Formulas
RangeFormula
D1D1=COUNTA(UNIQUE(FILTER(B1:B9,(B1:B9<=A2)*(C1:C9=A1))))
A2A2=TODAY()
 
Upvote 1
Thank you both! Both formulas work! I would have put both as the solution if I could.

Thank you so much for helping out :)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 1

Forum statistics

Threads
1,224,745
Messages
6,180,699
Members
452,994
Latest member
Janick

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