Formula to Count Unique ID numbers per month

Tmoske

Board Regular
Joined
Jan 14, 2009
Messages
145
I need to count how many unique ID numbers there are per month.I have figured out how to count the unique ID's for the first month (Jan) but after that I'm having trouble trying to get the count right for Feb and Mar. Formula I used in cell E2 is:
{=SUM(IF($A$2:$A$14<=DATE(2013,1,31),1/(COUNTIFS(A2:A14,"<="&DATE(2013,1,31),B2:B14,B2:B14)),0))}


-- removed inline image ---


Thanks,
Tmoske
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Sorry, the image of my spreadsheet did not stay when I hi submit thread. How do I post my table?
 
Upvote 0
How does your data look like? For the month is it simple June or 6/1/2014 etc..
 
Upvote 0
Maybe something like this (dates as dd/mm/yyyy)


A
B
C
D
E
F
1
Date​
ID​
Month​
Year​
Unique​
2
25/01/2014​
ID1​
1​
2014​
4​
3
26/01/2014​
ID2​
2​
2014​
2​
4
27/01/2014​
ID3​
5
28/01/2014​
ID4​
6
29/01/2014​
ID2​
7
30/01/2014​
ID1​
8
31/01/2014​
ID3​
9
01/02/2014​
ID1​
10
02/02/2014​
ID4​
11
03/02/2014​
ID1​
12
04/02/2014​
ID4​
13
05/02/2014​
ID4​
14
06/02/2014​
ID4​

Array formula in F2 copied down
=SUM(IF(FREQUENCY(IF($A$2:$A$14<>"",IF(MONTH($A$2:$A$14)=D2,IF(YEAR($A$2:$A$14)=E2,MATCH($B$2:$B$14,$B$2:$B$14,0)))),ROW($B$2:$B$14)-ROW($B$2)+1),1))

confirmed with Ctrl+Shift+Enter

M.
 
Upvote 0
Marcelo,
Thanks so much, the formula seems to work exactly the way that I needed.

-Tmoske :)
 
Upvote 0

Forum statistics

Threads
1,215,849
Messages
6,127,276
Members
449,372
Latest member
charlottedv

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