Category: FUNCTION | Updated: 2026-11-22

How to Use the COUNTUNIQUE Function in Google Sheets | Count Distinct Values

Syntax

=COUNTUNIQUE(value1, [value2, ...])
  • value1: The first value or range to consider for uniqueness.
  • value2, … (optional): Additional values or ranges to consider for uniqueness.

Example with a Table

Here is an example of counting how many distinct products were sold (excluding duplicates) from an order history product list (A2:A7).

Cell A (Product Name) B (Metric) C (Formula) D (Result)
1 Product Name Metric Formula Result
2 Apple Total Orders =COUNTA(A2:A7) 6
3 Orange Unique Products =COUNTUNIQUE(A2:A7) 3
4 Apple
5 Banana
6 Orange
7 Apple

Out of 6 order entries, 3 distinct products (Apple, Orange, and Banana) are counted.

Common Errors and Notes

  • Blank cells are not counted: Blank cells in the range are not counted as a unique value. However, be aware that cells returning an empty string "" from a formula may be counted.
  • Watch out for extra spaces: "Apple" and "Apple " (with a trailing space) are treated as different values and counted as 2 distinct items.
  • Counting unique values with criteria: If you want to apply conditions—such as how many distinct products a specific rep sold—use the COUNTUNIQUEIFS function.

Frequently Asked Questions

Q. Is the COUNTUNIQUE function case-sensitive?

A. No, it is not case-sensitive. For example, "Apple" and "apple" are treated as the same value and counted as 1 unique item.

Q. Does Excel also have a COUNTUNIQUE function?

A. No, COUNTUNIQUE is unique to Google Sheets. To achieve the same result in Excel, you need to combine functions like =COUNTA(UNIQUE(range)).