Counting Unique Numbers in Excel

118 Views Asked by At

Expected Results I am trying to count how many unique numbers are in a column.
I tried IF(A2=A3,"1","0"), but it doesn't work because there are multiple invoices in some cases.

Sample Column:

Sample Invoice Column

I am expecting to receive a count of 1 for each unique number.
For the 14 in the sample, I am expecting 9 unique numbers.

3

There are 3 best solutions below

0
Dominique On

There's a neat trick for this, like in this formula:

=SUM(1/COUNTIF(F4:F10,F4:F10))

Check following screenshot:

enter image description here

2
Vityata On

This is a formula to count unique values, considering that these are

  • in range("A1:A12"):

=SUM(IF(COUNTIF(A1:A12;A1:A12)=1;1;0))

  • in the whole column A:

=SUM(IF(COUNTIF(A:A;A:A)=1;1;0))

2
user11222393 On

With newer Excel versions:

=COUNT(UNIQUE(A:A))

enter image description here

New solution since OP updated question:

=IF(COUNTIF($A$1:A1,A1)>1,0,1)

In C1 to be dragged down. Result: enter image description here