Count unique values with a condition

malcolmk

New Member
Joined
Jan 3, 2007
Messages
2
I have an excel sheet that I use to keep track of sales from my sales team. One of the columns contains the CUSTOMER NAME and another column contains the SALESPERSON that has that customer.

WHAT I NEED TO SEE IS HOW MANY UNIQUE CUSTOMERS EACH SALESPERSON HAS SOLD TO.

A salesperson may make several sales to the same customer but it should only count it once. So although a salesperson may make 90-100 sales per month, it may only be to 30-40 unique customers!

I hope I have made myself clearly understood.

Thanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
I have an excel sheet that I use to keep track of sales from my sales team. One of the columns contains the CUSTOMER NAME and another column contains the SALESPERSON that has that customer.

WHAT I NEED TO SEE IS HOW MANY UNIQUE CUSTOMERS EACH SALESPERSON HAS SOLD TO.

A salesperson may make several sales to the same customer but it should only count it once. So although a salesperson may make 90-100 sales per month, it may only be to 30-40 unique customers!

I hope I have made myself clearly understood.

Thanks
CondDistinctCountWithFrequencyAndCountDiff.xls
ABCDEF
1With FREQUENCYWith COUNTDIFF
2Customer NameSalespersonSalesperson# Distinct Cust# Distinct Cust
3c1karlkarl33
4c3jonjon22
5c2karldamon33
6c6damondan33
7c5danbrian22
8c7damon
9c8brian
10c8dan
11c9dan
12c3karl
13c8jon
14c6brian
15c5damon
Sheet1


E3:

=SUM(IF(FREQUENCY(IF($A$3:$A$15<>"",IF($B$3:$B$15=D3,MATCH($A$3:$A$15,$A$3:$A$15,0))),ROW($A$3:$A$15)-ROW($A$3)+1),1))

which is confirmed with control+shift+enter, not just with enter, and copied down.

Invoking a formula with CountDiff of the morefunc.xll add-in...

F3:

=COUNTDIFF(IF($B$3:$B$15=D3,IF($A$3:$A$15<>"",$A$3:$A$15)),FALSE,FALSE)

which also must be confirmed with control+shift+enter, not just with enter, and copied down.
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,289
Members
449,149
Latest member
mwdbActuary

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