COUNT Unique Values in Microsoft Excel


What if you have a whole bunch of numbers and text characters in an array and you need to know how many unique numbers there are?

Perhaps you have a sales worksheet that lists a lot of part numbers in a column. You could use AutoFilter and check the drop-down list, but there are just too many to count manually.

Use an array formula for this. Array formulas, sometimes referred to as CSE formulas, require that after entering the formula, you press Ctrl+Shift+Enter, not just Enter.

This formula doesn’t count blank cells.

The entire formula is as follows (replace C3:C25 with the range of data you want the formula to check)

=SUM(IF(FREQUENCY(IF(LEN(C3:C25)>0,MATCH(C3:C25,C3:C25,0),""), IF(LEN(C3:C25)>0,MATCH(C3:C25,C3:C25,0),""))>0,1))

If you just want to count unique numbers, and not text, use the following formula instead:

=SUM(IF(FREQUENCY(C3:C25, C3:C25)>0,1))