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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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)


[Table="class: grid"][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]
Date​
[/td][td]
ID​
[/td][td] [/td][td]
Month​
[/td][td]
Year​
[/td][td]
Unique​
[/td][/tr]
[tr][td]
2
[/td][td]
25/01/2014​
[/td][td]
ID1​
[/td][td] [/td][td]
1​
[/td][td]
2014​
[/td][td]
4​
[/td][/tr]
[tr][td]
3
[/td][td]
26/01/2014​
[/td][td]
ID2​
[/td][td] [/td][td]
2​
[/td][td]
2014​
[/td][td]
2​
[/td][/tr]
[tr][td]
4
[/td][td]
27/01/2014​
[/td][td]
ID3​
[/td][td] [/td][td] [/td][td] [/td][td] [/td][/tr]
[tr][td]
5
[/td][td]
28/01/2014​
[/td][td]
ID4​
[/td][td] [/td][td] [/td][td] [/td][td] [/td][/tr]
[tr][td]
6
[/td][td]
29/01/2014​
[/td][td]
ID2​
[/td][td] [/td][td] [/td][td] [/td][td] [/td][/tr]
[tr][td]
7
[/td][td]
30/01/2014​
[/td][td]
ID1​
[/td][td] [/td][td] [/td][td] [/td][td] [/td][/tr]
[tr][td]
8
[/td][td]
31/01/2014​
[/td][td]
ID3​
[/td][td] [/td][td] [/td][td] [/td][td] [/td][/tr]
[tr][td]
9
[/td][td]
01/02/2014​
[/td][td]
ID1​
[/td][td] [/td][td] [/td][td] [/td][td] [/td][/tr]
[tr][td]
10
[/td][td]
02/02/2014​
[/td][td]
ID4​
[/td][td] [/td][td] [/td][td] [/td][td] [/td][/tr]
[tr][td]
11
[/td][td]
03/02/2014​
[/td][td]
ID1​
[/td][td] [/td][td] [/td][td] [/td][td] [/td][/tr]
[tr][td]
12
[/td][td]
04/02/2014​
[/td][td]
ID4​
[/td][td] [/td][td] [/td][td] [/td][td] [/td][/tr]
[tr][td]
13
[/td][td]
05/02/2014​
[/td][td]
ID4​
[/td][td] [/td][td] [/td][td] [/td][td] [/td][/tr]
[tr][td]
14
[/td][td]
06/02/2014​
[/td][td]
ID4​
[/td][td] [/td][td] [/td][td] [/td][td] [/td][/tr]
[/table]


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,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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