Count Unique Values in Google Sheets

In Google Sheets, there’s a specific function that you can use to count the unique values from a range of cells. And there’s one more function that can help you to count unique values with a condition.

Use COUNTUNIQUE to Count Unique Values

  1. First, enter the =COUNTUNIQUE in a cell.
  2. Then enter starting parentheses.
  3. After that, refer to the range where you have the values.
  4. Ultimately, enter the closing parentheses and hit enter to get the result.
count-unique-values
=COUNTUNIQUE(A1:A12)

There are 12 numbers in the range we specified, but as a unique count, we have 10 in the result.

countunique-function

Count Unique Values with a Condition

There’s also a function that you can use to count unique values with a condition. In the below example, we have a few dates in column A. Now we need to count all the unique dates which fall in April.

count-unique-values-with-condition
=COUNTUNIQUEIFS(A2:A11,A2:A11,">="&C1,A2:A11,"<="&D1)
  1. In a cell, enter the COUNTUNIQUEIF and enter the starting parentheses.
  2. After that, in the first argument, refer to the range from where you want to count the values.
  3. Next, in the third argument, refer to the range from where you want to check the condition. In our case, this range is also column A,
  4. Now, in the criteria1 argument, refer to cell C1 where we have the lowest date (01-April-2023) and use the greater than and equal to the operator (>=).
  5. From here, in the fifth argument, refer to the column A range again, and in the criteria2 argument, refer to the cell D1 with the lower than equal to the operator (<=).
  6. In the end, hit enter to get the result.
countuniqueifs-function

As a result, we have got 3. And in the range, we have four dates from April-2023, but as you can see, 17-April-2023 is twice in the range. That’s why the count of unique dates is 3 in the result.

Get the Sample Sheet