Count unique values


To count how many unique values are in a range, do you always need to use "Remove Duplicated" and then COUNT? Of course not—one formula will do.

=SUMPRODUCT(1/COUNTIF($A$2:$A$10,$A$2:$A$10))
That is SUMPRODUCT(1/COUNTIF(range,range))
COUNTIF(A2:A10,A2:A10)
  • It first counts how many times A2 appears in A2:A10, then how many times A3 appears, and so on up to A10...
  • For example, if the "B" in A3 appears 3 times in A2:A10, the count is 3.
  • Excel now has an array that records how many times each value in column A is duplicated.
1/COUNTIF(A2:A21,A2:A21))
  • Take the reciprocal of the repeat counts
  • For example, if "B" appears twice, that's 0.5, because it's 1/2
  • The 0.5 that appears twice adds up to 1, which represents one unique value.
SUMPRODUCT(1/COUNTIF(A2:A21,A2:A21)))
  • Add up all the unique values to get the answer.
[Hide] Join our 'Office Suite Real-Time Support' one-on-one sessions to learn more about Office. View details

Comprehensive Technical Support Solutions

We provide a range of technical support solutions to meet your needs.
Explore our core services:

man and woman wearing headphones while working in the office

Get on-demand assistance with Microsoft Excel, Word and PowerPoint. Send your question via WhatsApp, and we will help you resolve it promptly.

serious diverse students looking at laptop

Join our Online Learning Group Facebook page. Explore more than 200 tutorials and a comprehensive library of instructional videos at your own pace.

woman in yellow blazer doing a presentation

Build your team’s skills with tailored corporate training programmes. Our courses are designed around your organisation’s needs and equip employees with practical, up-to-date tools.