Counting the number of unique values

Excel 365 2016 2013 2010 2003
You can easily count the number of unique values of the range using a simple formula.

For example, you want to count the number of unique values of the range:

Data in Excel 2007

You can enter the next formula to the range D2:D12:

= SUM (1 / COUNTIF ($A$2:$A$12, $A$2:$A$12))

Summarize amount from a range D2:D12:

Data in Excel 2007

This formula has a serious limitation: If the range contains any blank cells, it returns an error. The following formula solves this problem:

= SUM (IF (COUNTIF ($A$2:$A$12, $A$2:$A$12) = 0, "", 1 / COUNTIF ($A$2:$A$12, $A$2:$A$12)))

Please, disable AdBlock and reload the page to continue

Today, 30% of our visitors use Ad-Block to block ads.We understand your pain with ads, but without ads, we won't be able to provide you with free content soon. If you need our content for work or study, please support our efforts and disable AdBlock for our site. As you will see, we have a lot of helpful information to share.