How to Count Only Unique Values Excluding Duplicates in Excel

We enter a list of numbers or products and there are some duplicates in the list, if we want to just do count for the unique values and exclude the duplicates, how can we do? Now you can follow the below steps to solve this question by formula quickly.

Prepare a list of products and there are some duplicates among the list. See example below:

Count Only Unique Values Excluding Duplicates 1

And we want to count the total product type in one year, how can we do count?

Count Only Unique Values Excluding Duplicates 2

If we just use sum formula to do count, then duplicates will be included, so we need another formula to do count excludes the duplicates. See steps below.

1. Count Unique Values Excluding Duplicates by Formula in Excel

Step 1: In E2 which is saved the total product type number, enter the formula:

=SUMPRODUCT(1/COUNTIF(B1:B11,B1:B11))

Where B1:B11 is the range you want to count the unique values.

Count Only Unique Values Excluding Duplicates 3

Step 2: Click Enter and get the result in E2. We can check the result is 6, and the duplicates are not included.

Count Only Unique Values Excluding Duplicates 4

In above sample, we do count for unique values and get the result 6, because we have six products A\B\C\D\E\F, and if we want to only count the unique values exclude all duplicates like product A\B\C (they appeared more than one season) how can we do count? See below steps.

2. Count Unique Values Excluding All Duplicates by Formula in Excel

Step 1: In E2 which is saved the total product type number, enter the formula:

=SUM(IF(FREQUENCY(MATCH(B1:B11,B1:B11,0),ROW(B1:B11)-ROW(B1)+1)=1,1))

Where B1:B11 is the range you want to count the unique values.

Count Only Unique Values Excluding Duplicates 5

Step2: Click Enter and get the result in E2. We can check the result is 3 (Product D\E\F are unique values and only appeared in one season).

Count Only Unique Values Excluding Duplicates 6

3. Video: Count Only Unique Values Excluding Duplicates

If you want to learn how to count only unique values excluding duplicates in Excel, this video will show you a simple and effective formula that you can use in any situation.

4. Related Functions

  • Excel SUMPRODUCT function
    The Excel SUMPRODUCT function multiplies corresponding components in the given one or more arrays or ranges, and returns the sum of those products.The syntax of the SUMPRODUCT function is as below:= SUMPRODUCT (array1,[array2],…)…
  • Excel COUNTIF function
    The Excel COUNTIF function will count the number of cells in a range that meet a given criteria. This function can be used to count the different kinds of cells with number, date, text values, blank, non-blanks, or containing specific characters.etc.= COUNTIF (range, criteria)…
  • Excel ROW function
    The Excel ROW function returns the row number of a cell reference.The ROW function is a build-in function in Microsoft Excel and it is categorized as a Lookup and Reference Function.The syntax of the ROW function is as below:= ROW ([reference])….
  • Excel MATCH function
    The Excel MATCH function search a value in an array and returns the position of that item.The syntax of the MATCH function is as below:= MATCH  (lookup_value, lookup_array, [match_type])…
  • Excel IF function
    The Excel IF function perform a logical test to return one value if the condition is TRUE and return another value if the condition is FALSE. The IF function is a build-in function in Microsoft Excel and it is categorized as a Logical Function.The syntax of the IF function is as below:= IF (condition, [true_value], [false_value])….
  • Excel SUM function
    The Excel SUM function will adds all numbers in a range of cells and returns the sum of these values. You can add individual values, cell references or ranges in excel.The syntax of the SUM function is as below:= SUM(number1,[number2],…)…