View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Counting Unique Values

If the data is in A1:A8, and there can be blank cells, try
=SUMPRODUCT((A1:A8<"")/COUNTIF(A1:A8,A1:A8&""))

If no blank cells, you could just try:
=SUMPRODUCT(1/COUNTIF(A1:A8,A1:A8))



"Paul Ferro" wrote:

I have a constant situation where I need to count the unique account #'s in
a column. For example, I might have a column that looks like this:

123155
684768
684768
165465
068589
068589
068589
015646

There are 8 account numbers listed, but only 5 unique numbers. What I have
been doing thus far is sorting the column (for example column A) then
putting the following formula all the way down column B:

if(a2=a1,"",a2)
if(a3=a2,"",a3)
etc...

Then, I can count all of the values in column B and it will give me the
unique account #'s.

Is there a better way to do this?

Thanks,
Paul