Count Unique Values in Excel Article byJeevan A Y Count Unique Values in Excel

To count only unique values in excel, we can adopt several options, and the top ones are shown below.

1. Count unique values using Sum and Countif function.
2. Count unique values using SUMPRODUCT and Countif function.

Now let us discuss each of the methods in detail along with an example –

#1 Count Unique Values using SUM and COUNTIF Function

Assume you are working as a sales manager, and you have sales data in front of you. Many customers purchased the product at multiple time frame in the month. You need total customers in the month.

You can download this COUNT Unique Values Excel Template here – COUNT Unique Values Excel Template

Below are the steps used to find count unique values using sum function –

1. Copy the below data to your excel file. 2. Apply the below formula in the cell E3 to get the total unique values. Now let me break down the formula in detail.

The formula I have used here is:

If you take a close at the formula, it is surrounded by curly brackets. It is not entered by me; rather, it is an indication that it is an array formula.

Once you finished with the formula before we hit enter, we need to use the key:

Ctrl + Shift + Enter this would enter those curly brackets automatically for you.

This is a bit new formula if you are working with  for the first time. Let me break down the formula into three pieces.

Now press the key F9.

Now we are dividing the above values by number 1.

Now Sum function add all those numbers that are appeared in the above image and gives the total as 12. Therefore the total number of unique values in the list is 12.

How Does Calculation work?

• If the values are there in the list two times, then it is ½, i.e., 0.5. If the value is there in the list three times, then it is 1/3, i.e., 0.3333.
• In our list, the first name is Ruturaj that is appearing three times in the list, so our result showing 0.33333333 as the value.
• Our second name Kamal appearing only one time, and the formula read like this 1/1 I .e.1 only.
• This COUNTIF and SUM function can give us the total number of unique values in the list.

#2 Count Unique Values using SUMPRODUCT and COUNTIF Function

Take the same data from the previous example.

In this example, I will discuss the method of counting unique values with the COUNTIF function. This is not an array formula I am going to use in this example rather a normal formula I am using.

• Step 1: Copy the below data to your excel file.
• Step 2: Apply the below formula in the cell E6 to get the total unique values.

Now let me break down the formula in detail.

The formula I have used here is:

In our previous example, I have used the Array formula, i.e., closing the formula with Ctrl + Shift + Enter.

If I break down the formula using the F9 key, it exactly works the same as the previous one.

Now SUMPRODUCT function adds all those numbers that are appeared in the above image and gives the total as 12. Therefore the total number of unique values in the list is 12.

Handling Blanks in the Range

If the value list contains any of the empty cells, then the formula returns the result as an , i.e., #DIV/0!.

In the above image row, number 10 is the empty row. Since there is an empty row, the formula returned the result as an error, i.e., #DIV/0!.

We can handle these kinds of errors by inserting nothing ( “” ) value to it.

At the end of the countif formula, we need to nothing value by using an ampersand symbol then deduct the whole result by -1 because even the empty cell is treated as a unique value by the formula.

Note: If there are two empty rows, then we can use -2; if there are three empty rows, then we can use -3, and so on.

Things to Remember

• We need to use Ctrl + Shift + Enter to close the formula in case of array formulas. Even when we are editing the formula, we cannot simply close the bracket; we need to .
• We can get the unique list just by removing duplicate values from the list.
• An array formula cannot be applied to merged cells.

Recommended Articles

This has been a Guide to Count Unique Values in Excel. Here we use COUNTIF Function along with SUM and SUMPRODUCT to count unique values in Excel along with the excel template. You may also look at these useful functions in excel –

• 35+ Courses
• 120+ Hours