How to Count Cells with Multiple Criteria in Excel

📅 Feb 07, 2026 📝 Sarah Miller

Isolating specific data points across complex spreadsheets often leads to analytical frustration when standard filters fall short. When evaluating organizational budgets, managers typically review standard funding sources to assess baseline revenue. However, leveraging the COUNTIFS formula grants users the precise filtering power needed to cross-reference multiple variables simultaneously. As a critical stipulation, all targeted criteria ranges must be of identical dimensions to prevent formula errors. For example, this allows you to seamlessly count occurrences of "Federal Grants" directed specifically to "Education" projects. Below, we outline the step-by-step formula syntax and best practices for multi-criteria counting.

How to Count Cells with Multiple Criteria in Excel

Whether you are tracking project milestones, analyzing sales performance, or managing inventory, data analysis in Microsoft Excel often requires you to isolate specific subsets of data. One of the most common tasks is counting how many cells or rows meet multiple criteria simultaneously.

Excel provides several powerful tools to accomplish this, ranging from the straightforward COUNTIFS function to advanced array formulas like SUMPRODUCT and modern dynamic arrays like FILTER. In this comprehensive guide, we will explore these methods with step-by-step examples, explaining when and how to use each approach effectively.

The Sample Dataset

To help visualize these formulas in action, we will reference the following sample sales dataset containing columns for Sales Rep, Region, Sales Amount, and Product (Data range: A2:D10):

Row A (Sales Rep) B (Region) C (Sales Amount) D (Product)
2 Alice East $12,000 Widgets
3 Bob West $8,500 Gadgets
4 Charlie East $4,200 Widgets
5 Diana North $15,000 Gizmos
6 Evan East $9,800 Gadgets
7 Fiona West $3,100 Widgets
8 George South $11,500 Gizmos
9 Hannah East $6,000 Widgets
10 Ian West $14,000 Gizmos

Method 1: The COUNTIFS Function (Standard AND Logic)

The COUNTIFS function is the go-to tool for counting cells that meet multiple criteria. It operates on AND logic, meaning a row is only counted if all specified criteria are met.

Syntax:

=COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], ...)

Example 1: Counting with Text and Numeric Criteria

Suppose you want to count how many sales in the East region were greater than $5,000.

  • Criteria Range 1: Region column (B2:B10)
  • Criteria 1: "East"
  • Criteria Range 2: Sales Amount column (C2:C10)
  • Criteria 2: ">5000"

Your formula will look like this:

=COUNTIFS(B2:B10, "East", C2:C10, ">5000")

Result: 3 (Alice, Evan, and Hannah meet both criteria).

Example 2: Counting Dates Within a Range

If you have a column of dates (e.g., in column E) and want to count transactions that occurred between January 1, 2023, and December 31, 2023, you apply COUNTIFS to the same range twice:

=COUNTIFS(E2:E10, ">=1/1/2023", E2:E10, "<=12/31/2023")

Method 2: Using COUNTIFS with Cell References

Hardcoding values like "East" or 5000 inside formulas makes your spreadsheets rigid. It is best practice to link your criteria to specific cell references.

When using logical operators (like >, <, or <>) with cell references, you must enclose the operator in quotation marks and use the ampersand (&) to concatenate it with the cell reference.

Imagine cell F1 contains the text East and cell F2 contains the number 5000. The formula becomes:

=COUNTIFS(B2:B10, F1, C2:C10, ">"&F2)

This allows you to change the values in F1 and F2 to dynamically update your counts without modifying the formula itself.


Method 3: Counting with OR Logic

The standard COUNTIFS function does not natively support OR logic (counting if Criterion A or Criterion B is met). Fortunately, there are simple workarounds depending on whether the criteria are in the same column or different columns.

Case A: OR Criteria in the Same Column

If you want to count sales that occurred in either the East OR the West region, you have two primary methods:

Option 1: Adding Multiple COUNTIFS Formulas

Since the regions are mutually exclusive, you can simply add two COUNTIFS (or COUNTIF) statements together:

=COUNTIFS(B2:B10, "East") + COUNTIFS(B2:B10, "West")

Result: 4 (East) + 3 (West) = 7.

Option 2: Using an Array Constant wrapped in SUM

For cleaner syntax when dealing with many OR conditions, pass the criteria as an array constant enclosed in curly braces {}, and wrap the entire expression in the SUM function:

=SUM(COUNTIFS(B2:B10, {"East", "West"}))

Excel evaluates this by generating two counts-one for "East" and one for "West"-and then summing those results.

Case B: OR Criteria across Different Columns

If you want to count transactions where the Region is East OR the Product is Gizmos, you cannot simply add two COUNTIFS. Doing so would double-count any rows where both conditions are true (like Diana or George in an expanded dataset). For this, we must use SUMPRODUCT.


Method 4: The SUMPRODUCT Function (Advanced Logic)

The SUMPRODUCT function is an incredibly versatile tool that handles complex arrays without requiring special array-entry keystrokes in older Excel versions.

In array logic, addition (+) corresponds to OR, while multiplication (*) corresponds to AND.

How It Works

When you evaluate a condition like (B2:B10="East"), Excel generates an array of boolean values (TRUE or FALSE). When you perform mathematical operations (like * or +) on these booleans, Excel coaxes them into numbers: TRUE becomes 1, and FALSE becomes 0.

Example 1: Complex OR Criteria Across Different Columns

To count rows where the Region is "East" OR the Product is "Gizmos":

=SUMPRODUCT(--(((B2:B10="East") + (D2:D10="Gizmos")) > 0))

Why the >0 and double unary (--)? If a row met both criteria, the addition would yield 2 (1 + 1). Checking if the sum is greater than 0 converts the array back to TRUE/FALSE, ensuring each row is counted exactly once. The double unary (--) then converts those TRUE/FALSE values back to 1s and 0s for SUMPRODUCT to add up.

Example 2: Combining AND and OR Logic

Let's find the number of sales where the Region is "East" AND the Product is either "Widgets" OR "Gadgets":

=SUMPRODUCT((B2:B10="East") * ((D2:D10="Widgets") + (D2:D10="Gadgets")))

Result: 4 (Alice, Charlie, Evan, and Hannah meet this complex logic).


Method 5: Modern Dynamic Arrays (Excel 365 & 2021)

If you are using modern Excel, you can leverage the FILTER function paired with ROWS to count matching cells. This method is highly intuitive because it mimics how humans filter and count rows manually.

Syntax:

=ROWS(FILTER(array, include, [if_empty]))

Example: Count "East" Region Sales Over $5,000

To count these matching rows, filter the dataset to show only the matching records, and then count the number of rows in the resulting filtered array:

=ROWS(FILTER(A2:D10, (B2:B10="East") * (C2:C10>5000)))

To prevent the formula from returning a #CALC! error if no rows match, use the third argument of FILTER to return an empty array or text, and handle it accordingly:

=IFERROR(ROWS(FILTER(A2:D10, (B2:B10="North") * (C2:C10>50000))), 0)

Best Practices and Pitfalls

  • Case Sensitivity: By default, COUNTIFS, SUMPRODUCT, and FILTER are not case-sensitive. "EAST" and "east" will yield identical results. If you require case-sensitive counts, you must use the EXACT function inside SUMPRODUCT.
  • Wildcards: For partial text matches, you can use wildcards in COUNTIFS. The asterisk (*) represents any number of characters, while the question mark (?) represents a single character. For example, =COUNTIFS(D2:D10, "*gets") will count both "Widgets" and "Gadgets".
  • Empty Cells: Keep in mind that referencing blank cells can sometimes produce unexpected results depending on whether your operator is checking for blank strings ("") or literal empty cells. Use "<>" as a criterion to count only non-blank cells.

Summary of Methods

Choosing the right formula depends on your version of Excel and the logical layout of your criteria:

  • Use COUNTIFS for straightforward AND conditions.
  • Use SUM with COUNTIFS (using curly braces) for simple OR conditions within the same column.
  • Use SUMPRODUCT for complex AND/OR logic across multiple columns, especially in Excel 2019 and older.
  • Use ROWS and FILTER in Excel 365 or 2021 for an intuitive, modern approach to filtering and counting data.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.