Google Sheets Guide · Prompt: “Count rows where Plan in B2:B6 is "Pro" and Country in C2:C6 is "US"”

Count Distinct Values with Criteria Using COUNTUNIQUEIFS

Verified by LiveFormulaLab Engineering Team • Updated November 2026

Count distinct users, orders, or accounts meeting multiple filter conditions in Google Sheets using COUNTUNIQUEIFS and live examples.

Verified Google Sheets Syntax

=COUNTIFS(B2:B6, "Pro", C2:C6, "US")

How This Formula Works (Step-by-Step)

Google Sheets provides a dedicated COUNTUNIQUEIFS function that counts distinct items in a range while applying multiple criteria.

Step 1: Pass the unique-item column (such as User ID in A2:A6) as the first argument.

Step 2: Add criteria range and condition pairs just like COUNTIFS.

Formula Syntax & Arguments Breakdown

Counts unique values or qualified rows satisfying multiple parallel criteria ranges—using COUNTUNIQUEIFS for distinct counts and COUNTIFS for matching row totals.

Argument / ClauseRequirementData TypeRole & Behavior
count_unique_range / criteria_range1 (B2:B6)RequiredRangeColumn checked against the first criteria (or deduplicated target column in COUNTUNIQUEIFS).
criteria1 ("Pro")RequiredCriteriaCondition string, comparison operator, or cell reference applied to criteria_range1.
criteria_range2 & criteria2 (C2:C6, "US")OptionalRange & CriteriaAdditional filter pairs narrowing the count via logical AND.

3 Real-World Use Cases

  • Counting unique paying subscribers per country without double-counting renewals.
  • Measuring distinct active weekly users inside product telemetry exports.
  • Auditing unique SKUs sold during a flash promotion.

Cross-Platform Equivalents

Excel
=COUNTA(UNIQUE(FILTER(A2:A6, (B2:B6="Pro")*(C2:C6="US"))))
SQL
SELECT COUNT(DISTINCT user_id) FROM subscriptions WHERE plan = 'Pro' AND country = 'US';
Python Pandas
df[(df['Plan'] == 'Pro') & (df['Country'] == 'US')]['User ID'].nunique()

Common Mistakes & Pro Tips

Pitfalls & How to Fix Them

  • Mistake: Opening a Sheet containing COUNTUNIQUEIFS in Microsoft Excel causes a #NAME? error because COUNTUNIQUEIFS is exclusive to Google Sheets.

    Fix: When sharing workbooks with Excel users, use Excel 365 COUNTA(UNIQUE(FILTER(...))) or stick to COUNTIFS.

  • Mistake: Including blank cells in the target range does not increment unique count, but trailing spaces turn "Pro " and "Pro" into 2 unique entries.

    Fix: Normalize text columns with TRIM() before counting unique entities.

  • Mistake: Mismatching row counts between the unique column and any criteria range returns #VALUE!.

    Fix: Keep start and end rows identical across every range argument.

Engineering Pro Tips

  • In Google Sheets, =COUNTUNIQUEIFS(A2:A100, B2:B100, "Pro", C2:C100, "US") counts unique customer IDs matching both conditions natively.
  • Use wildcard patterns like "*Enterprise*" inside COUNTUNIQUEIFS criteria to bucket sub-plans together.
  • Combine with QUERY when you need unique counts broken down across every month in a single summary table.

Frequently Asked Questions

Does Excel have COUNTUNIQUEIFS?
No, Excel uses COUNTA(UNIQUE(FILTER(...))) instead of COUNTUNIQUEIFS.
What does COUNTUNIQUEIFS return if zero rows match?
It cleanly returns 0 without throwing an error.
Are blank cells counted as a unique value?
No, COUNTUNIQUEIFS ignores empty cells in the count_unique_range.

Related Formulas & Guides