?
Solved

Count Unique Coustomers in excel by Month

Posted on 2012-12-29
4
Medium Priority
?
353 Views
Last Modified: 2012-12-29
I have a table with the following fields

CoustomerID   Date  


one coustomer may order 50 things in one month. I want to be able to count the number of coustomer ordering per month.

Any help?
sample.xlsx
0
Comment
Question by:the_Apple
4 Comments
 
LVL 10

Expert Comment

by:schaps
ID: 38729517
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 38729569
Try this formula

=SUM(IF(FREQUENCY(IF(TEXT(B2:B2628,"MMMYY")=$D$2,MATCH(A2:A2628,A2:A2628,0),""), IF(LEN(A2:A2628)>0,MATCH(A2:A2628,A2:A2628,0),""))>0,1))

where cell D2 should contain a month text in the form of "JUL11"
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 2000 total points
ID: 38729580
Edit: I missed Saqib's suggestion, posted while I was composing this - my suggestion is very similar.....

If you put the first of each month in F2 down then this "array formula" in G2 will give a "distinct count" of customers for that month

=SUM(IF(FREQUENCY(IF(B$2:B$3000-DAY(B$2:B$3000)+1=F2,MATCH(A$2:A$3000,A$2:A$3000,0)),ROW(B$2:B$3000)-ROW(B$2)+1),1))

confirmed with CTRL+SHIFT+ENTER and copied down

see attached

Note: you have some dates that I assume are incorrect, e.g. one in 2020, one in 2070

regards, barry
distinct-count.xlsx
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 38729590
To get a count of distinct customers by month:

1) In C1 of your original worksheet, add a label such as Unique Customers

2) In C2, add this formula...
=1/SUMPRODUCT(($A$2:$A$2628=A2)*(TEXT($B$2:$B$2628,"yyyy-mm")=TEXT(B2,"yyyy-mm")))
then copy that down through C2628

3) Create a PivotTable, with ApptDate as the row field, and (sum of) Unique Customers as the data field

4) Rightclick one of the dates in your PivotTable, and select Group from the popup menu.  Group your dates by year and month

Please see the attached sample file.

Q-27980493.xlsx
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question