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
- First, enter the =COUNTUNIQUE in a cell.
- Then enter starting parentheses.
- After that, refer to the range where you have the values.
- Ultimately, enter the closing parentheses and hit enter to get the result.
=COUNTUNIQUE(A1:A12)
There are 12 numbers in the range we specified, but as a unique count, we have 10 in the result.
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.
=COUNTUNIQUEIFS(A2:A11,A2:A11,">="&C1,A2:A11,"<="&D1)
- In a cell, enter the COUNTUNIQUEIF and enter the starting parentheses.
- After that, in the first argument, refer to the range from where you want to count the values.
- 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,
- 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 (>=).
- 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 (<=).
- In the end, hit enter to get the result.
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.