# Counting unique values occouring in a month

#### PeterCol

##### New Member
I have a table recording contacts and date contacted over a period of years. I wish to count the number of unique contacts per month so that regardless of whether they have been in contact once or ten times in that month they are counted only once per month. Ideally I would like to do this with a single query if it is possible.

Thanks

### Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},\$Z\$1:\$Z\$99,\$Y\$1:\$Y\$99),2,False) to lookup Y values to left of Z values.

#### jobb

##### Board Regular

first query:

calculated fields

GROUP BY
Year: DatePart("yyyy",[Date])
GROUP BY
Month: DatePart("m",[Date])
GROUP BY
[CONTACT]

second query
(based on first query)
GROUP BY
[YEAR]
GROUP BY
[MONTH]
COUNT
[CONTACT]

#### ddeldeb

##### New Member
You could also try a SELECT Distinct(contacts), from......
But just the slightest difference in a record will make it distinct so you need to be a little carefull on what fields you use.

#### PeterCol

##### New Member
Yes the 2 queries work thanks. Just not as tidy as one and I need to repeat the queries for numerous other fields.

thanks again.

Replies
5
Views
120
Replies
2
Views
65
Replies
0
Views
106
Replies
11
Views
409
Replies
2
Views
275

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,152,101
Messages
5,768,100
Members
425,453
Latest member
bince

### 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.

### Which adblocker are you using?

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

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