count

C

Carla

I want to count how many different customers are in a column. I have a lot
of duplicate customers, so I need a formula that will tell me how many
different ones there are. In my example below the total count is 4 in a
total of 5 lines.

I.E.
adva
palm
palm
john
teak
 
T

T. Valko

One way...

If there might be empty cells within the range:

=SUMPRODUCT((A2:A6<>"")/COUNTIF(A2:A6,A2:A6&""))

If there won't be any empty cells within the range:

=SUMPRODUCT(1/COUNTIF(A2:A6,A2:A6))
 
C

Carla

I tried that formula with a column showing numbers 1-10 with your formula,
and it said I only have 9 different items when it should be 10.

Now, when I did it with words, it worked correctly.

Thank you,
Carla
 
G

Gord Dibben

You sure you don't have a repeat of one of those numbers?

Returns 10 for me with 1 through 10 in A1:A10


Gord Dibben MS Excel MVP
 
R

ryguy7272

There are many ways to count uniques among duplicates:
=SUMPRODUCT((A2:A105<>"")/(COUNTIF(A2:A105,A2:A105&"")))
=SUMPRODUCT((A2:A998<>"")/(COUNTIF(A2:A998,A2:A998)+(A2:A998="")))
=SUM(IF(FREQUENCY(IF(LEN(A2:A999)>0,MATCH(A2:A999,A2:A999,0),""),IF(LEN(A2:A999)>0,MATCH(A2:A999,A2:A999,0),""))>0,1))
Note: This is a CSE Function
=SUMPRODUCT((A2:A105<>"")/COUNTIF(A2:A105,A2:A105&"")*(A2:A105<>""))
=SUMPRODUCT(--(A2:A999<>""),1/COUNTIF(A2:A999,A2:A999&""))
=SUM(--(FREQUENCY(IF(A2:A2705<>"",MATCH(A2:A2705,A2:A2705,0)),ROW(INDIRECT("1:"&ROWS(A2:A2705))))>0))
Note: This is a CSE Function
=COUNT(1/FREQUENCY(A1:A400,A1:A400))
=SUM(1/COUNTIF(C13:C17,C13:C17))
Note: This is a CSE Function & it fails if there are any blanks in between
=SUM(IF(A2:A400<>"",1/COUNTIF(A2:A400,A2:A400)))
=SUM(IF(FREQUENCY(IF(A2:A1001<>"",MATCH("~"&A2:A1001,A2:A1001&"",0)),ROW(A2:A1001)-ROW(A2)+1),1))

=IF(COUNT(A1:A20)<ROW(A1),"",INDEX(A1:A20,MATCH(SMALL(A1:A20,ROW(A1)),A1:A20,0)))


HTH,
Ryan---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top