Excel Guide · Prompt: “Count how many rows in B2:B6 match "Enterprise" and have Revenue > 50000 in C2:C6”
Count Unique Values with Criteria in Excel
Verified by LiveFormulaLab Engineering Team • Updated November 2026
Count distinct customers, orders, or IDs that match a condition in Excel without pivot tables. Interactive sandbox included.
Verified Excel Syntax
=COUNTIFS(B2:B6, "Enterprise", C2:C6, ">50000")How This Formula Works (Step-by-Step)
To count distinct or filtered records cleanly, pair FILTER with COUNTA(UNIQUE(...)) in Excel 365, or COUNTIFS for multi-condition row counting.
Step 1: Define the segment criteria range B2:B6 equal to "Enterprise".
Step 2: Apply the numeric threshold ">50000" on C2:C6 to count qualifying accounts.
Formula Syntax & Arguments Breakdown
Evaluates multi-criteria row filtering using COUNTIFS (or COUNTA(UNIQUE(FILTER(...))) in Excel 365) to count qualified records or distinct entities accurately.
| Argument / Clause | Requirement | Data Type | Role & Behavior |
|---|---|---|---|
criteria_range1 (B2:B6) | Required | Cell Range | First attribute column evaluated row-by-row (for example, Segment or Status). |
criteria1 ("Enterprise") | Required | Criteria | Exact text, wildcard, or comparison operator required on criteria_range1. |
criteria_range2 & criteria2 (C2:C6, ">50000") | Optional | Range & Criteria | Additional filter column and threshold paired with criteria1 using logical AND semantics. |
3 Real-World Use Cases
- Counting unique active enterprise buyers within a specific region.
- Measuring distinct support tickets escalated above SLA threshold.
- Auditing how many unique campaigns drove conversions above target ROAS.
Cross-Platform Equivalents
- Excel
=COUNTA(UNIQUE(FILTER(A2:A6, (B2:B6="Enterprise")*(C2:C6>50000))))- SQL
SELECT COUNT(DISTINCT account) FROM deals WHERE segment = 'Enterprise' AND revenue > 50000;- Python Pandas
df[(df['Segment'] == 'Enterprise') & (df['Revenue'] > 50000)]['Account'].nunique()
Common Mistakes & Pro Tips
Pitfalls & How to Fix Them
Mistake: Using COUNTA(UNIQUE(FILTER(...))) without checking for empty FILTER results returns 1 instead of 0 because #CALC! counts as one error cell.
Fix: Wrap the Excel 365 unique count in =IFERROR(COUNTA(UNIQUE(FILTER(A2:A6, (B2:B6="Enterprise")*(C2:C6>50000)))), 0).
Mistake: Passing ranges of unequal row heights to COUNTIFS produces a #VALUE! error.
Fix: Verify every criteria range in COUNTIFS covers the exact same row start and end numbers.
Mistake: Writing ">50,000" with a literal comma inside criteria strings can fail numeric parsing depending on regional settings.
Fix: Keep numeric comparison criteria unformatted without commas or currency symbols: ">50000".
Engineering Pro Tips
- To count distinct accounts matching criteria in Excel 365, combine UNIQUE with FILTER: =ROWS(UNIQUE(FILTER(A2:A6, B2:B6="Enterprise"))).
- In older Excel versions without UNIQUE, use SUM(1/COUNTIFS(...)) or a PivotTable with "Add this data to the Data Model" enabled for Distinct Count.
- Combine wildcards ("*Cloud*") inside COUNTIFS criteria when grouping messy free-text tags.
Frequently Asked Questions
- How do I count strictly unique names matching a condition in Excel 365?
- Use =COUNTA(UNIQUE(FILTER(A2:A6, (B2:B6="Enterprise")*(C2:C6>50000)))).
- What happens if FILTER finds zero rows?
- COUNTA(UNIQUE(FILTER(...))) can return 1 for #CALC!, so wrap with IFERROR(..., 0).
- Does COUNTIFS support wildcards?
- Yes, use "*" for any sequence of characters and "?" for a single character.
Related Formulas & Guides
- Calculate Business Days Between Two Dates in Excel — Compute working days between two dates in Excel excluding weekends and holidays with NETWORKDAYS and DATEDIF. Copy and test live.
- Find Conditional Maximum Value in Excel with MAXIFS — Find the largest value matching one or more criteria in Excel using MAXIFS. Copy the formula and compare SQL and Python equivalents.
- Split Full Name Into First and Last Name in Excel — Separate first names and last names cleanly in Excel using LEFT, RIGHT, and FIND. Test the formula live with editable contact rows.
- How to Create a Running Total Formula in Excel — Build a cumulative running total column in Excel using expanding range references ($B$2:B2). Test live with editable monthly numbers.