Category: FUNCTION | Updated: 2026-11-22
How to Use the COUNTUNIQUEIFS Function in Google Sheets | Count Distinct Values Matching Criteria
Syntax
=COUNTUNIQUEIFS(range, criteria_range1, criterion1, [criteria_range2, criterion2, ...])
- range: The range of cells to count unique values from.
- criteria_range1: The range of cells to evaluate against
criterion1(must have the same number of rows and columns asrange). - criterion1: The condition to apply to
criteria_range1(text, number, comparison operator, etc.). - criteria_range2, criterion2, … (optional): Additional pairs of criteria ranges and criteria.
Example with a Table
Here is an example of counting the number of distinct products (excluding duplicates) sold by “Sato” from a sales history by representative (A2:B7).
| Cell | A (Rep) | B (Product Name) | C (Filter Criterion) | D (Formula) | E (Result) |
|---|---|---|---|---|---|
| 1 | Rep | Product Name | Target Rep | Formula | Result |
| 2 | Sato | Laptop | Sato | =COUNTUNIQUEIFS(B2:B7, A2:A7, C2) |
2 |
| 3 | Suzuki | Mouse | |||
| 4 | Sato | Keyboard | |||
| 5 | Sato | Laptop | |||
| 6 | Suzuki | Monitor | |||
| 7 | Suzuki | Keyboard |
Sato has 3 records, but because “Laptop” is repeated, the unique product count 2 is returned.
Common Errors and Notes
#VALUE!Error: Occurs whenrangeandcriteria_rangedo not have the same number of rows or columns (e.g., specifyingB2:B7andA2:A6).- Not compatible with Excel:
COUNTUNIQUEIFSis a Google Sheets–only function. Note that downloading the sheet as an Excel file will result in a#NAME?error. - Writing comparison operators: When specifying conditions such as “100 or more,” you must enclose the operator in double quotes, like
">=100".
Frequently Asked Questions
Q. Does COUNTUNIQUEIFS support multiple criteria (AND conditions)?
A. Yes, it does. By adding pairs like "criteria_range1, criterion1, criteria_range2, criterion2...", you can count unique values that meet all specified criteria.
Q. What happens if no data matches the criteria?
A. Instead of returning an error, it returns 0.