Counting Unique names only, based on a couple of criteria

dixiebritt

Board Regular
Joined
Jan 8, 2014
Messages
63
[TABLE="width: 500"]
<tbody>[TR]
[TD]Quarter[/TD]
[TD]SR[/TD]
[TD]Client[/TD]
[/TR]
[TR]
[TD]q1[/TD]
[TD]jane[/TD]
[TD]abc company[/TD]
[/TR]
[TR]
[TD]q1[/TD]
[TD]jane[/TD]
[TD]mcg inc[/TD]
[/TR]
[TR]
[TD]q1[/TD]
[TD]jane[/TD]
[TD]mcg inc[/TD]
[/TR]
[TR]
[TD]q1[/TD]
[TD]house[/TD]
[TD]box llc[/TD]
[/TR]
[TR]
[TD]q1[/TD]
[TD]bob[/TD]
[TD]hti[/TD]
[/TR]
[TR]
[TD]q2[/TD]
[TD]bob[/TD]
[TD]hti[/TD]
[/TR]
[TR]
[TD]q2[/TD]
[TD]bob[/TD]
[TD]apple[/TD]
[/TR]
[TR]
[TD]q2[/TD]
[TD]jane[/TD]
[TD]abc company[/TD]
[/TR]
</tbody>[/TABLE]

I have this set of data. I want to do two things:
1. calculate the number of total unique clients by Quarter and SR
2. calculate the number of total unique clients by Quarter only
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try:

ABCDEFGHIJK
QuarterSRClientQuarterSR# Unique ClientsQuarter# Unique Clients
q1janeabc companyq1Janeq2
q1janemcg inc
q1janemcg inc
q1housebox llc
q1bobhti
q2bobhti
q2bobapple
q2janeabc company

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: right"][/TD]

[TD="align: right"]2[/TD]
[TD="align: right"][/TD]

[TD="align: right"]4[/TD]
[TD="align: right"][/TD]

[TD="align: center"]3[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: right"][/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]8[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]9[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>
Sheet4

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]G2[/TH]
[TD="align: left"]{=SUM(SIGN(FREQUENCY(IF($A$2:$A$9=E2,IF($B$2:$B$9=F2,MATCH($C$2:$C$9,$C$2:$C$9,0))),ROW($C$2:$C$9)-ROW($C$2)+1)))}[/TD]
[/TR]
[TR]
[TH]J2[/TH]
[TD="align: left"]{=SUM(SIGN(FREQUENCY(IF($A$2:$A$9=I2,MATCH($C$2:$C$9,$C$2:$C$9,0)),ROW($C$2:$C$9)-ROW($C$2)+1)))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Eric,

The formula in J2 seems perfect to me but i think it should return 3, not 4 - maybe you have pasted the wrong cell.

M.
 
Upvote 0

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #DCE6F1"][/TD]
[TD="bgcolor: #DCE6F1"]
A
[/TD]
[TD="bgcolor: #DCE6F1"]
B
[/TD]
[TD="bgcolor: #DCE6F1"]
C
[/TD]
[TD="bgcolor: #DCE6F1"]
D
[/TD]
[TD="bgcolor: #DCE6F1"]
E
[/TD]
[TD="bgcolor: #DCE6F1"]
F
[/TD]
[TD="bgcolor: #DCE6F1"]
G
[/TD]
[TD="bgcolor: #DCE6F1"]
H
[/TD]
[TD="bgcolor: #DCE6F1"]
I
[/TD]
[TD="bgcolor: #DCE6F1"]
J
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
1
[/TD]
[TD]
Quarter​
[/TD]
[TD]
SR​
[/TD]
[TD]
Client​
[/TD]
[TD][/TD]
[TD]
Quarter​
[/TD]
[TD]
SR​
[/TD]
[TD]
# Unique Clients​
[/TD]
[TD][/TD]
[TD]
Quarter​
[/TD]
[TD]
# Unique Clients​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
2
[/TD]
[TD]
q1​
[/TD]
[TD]
jane​
[/TD]
[TD]
abc company​
[/TD]
[TD][/TD]
[TD]
q1​
[/TD]
[TD]
Jane​
[/TD]
[TD="bgcolor: #D9D9D9"]
2​
[/TD]
[TD][/TD]
[TD]
q2​
[/TD]
[TD="bgcolor: #D9D9D9"]
3​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
3
[/TD]
[TD]
q1​
[/TD]
[TD]
jane​
[/TD]
[TD]
mcg inc​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
4
[/TD]
[TD]
q1​
[/TD]
[TD]
jane​
[/TD]
[TD]
mcg inc​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
5
[/TD]
[TD]
q1​
[/TD]
[TD]
house​
[/TD]
[TD]
box llc​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
6
[/TD]
[TD]
q1​
[/TD]
[TD]
bob​
[/TD]
[TD]
hti​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
7
[/TD]
[TD]
q2​
[/TD]
[TD]
bob​
[/TD]
[TD]
hti​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
8
[/TD]
[TD]
q2​
[/TD]
[TD]
bob​
[/TD]
[TD]
apple​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
9
[/TD]
[TD]
q2​
[/TD]
[TD]
jane​
[/TD]
[TD]
abc company​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="bgcolor: #DCE6F1"]
10
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


Array formulas in G2 and J2 provided by Eric in post 2.

M.
 
Last edited:
Upvote 0
Good catch Marcelo. After I posted the formulas, I noticed that the J2 formula was pointing to the wrong cell, so I fixed it. But I didn't fix the result cell, so that's why it shows incorrectly. Thanks for the assist.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,248
Members
452,623
Latest member
cliftonhandyman

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