Google Sheets Countifs: Mastering Multiple Criteria

Learn how to count with multiple criteria in Google Sheets using COUNTIFS, SUMPRODUCT, and FILTER. This practical guide covers syntax, examples, and performance tips for reliable, scalable spreadsheets.

How To Sheets
How To Sheets Team
·5 min read
COUNTIFS Mastery - How To Sheets
Photo by jeonghwaryu0via Pixabay
Quick AnswerDefinition

In Google Sheets, counting with multiple criteria relies on COUNTIFS, SUMPRODUCT, or FILTER for multi-condition counts. COUNTIFS handles several criteria directly, while more complex logic may require SUMPRODUCT or FILTER combinations. This guide demonstrates practical COUNTIFS usage, with real examples, edge cases, and performance tips.

Understanding COUNTIF vs COUNTIFS

COUNTIF counts a single criterion; COUNTIFS counts multiple. In Google Sheets, consider when to use one vs the other. When you have more than one condition, COUNTIFS is the natural choice. If you only need a single condition, COUNTIF keeps things simple and readable. Below are simple illustrations to illustrate the difference, followed by practical examples you can adapt to your dataset.

Excel Formula
=COUNTIF(A2:A100, "North")
Excel Formula
=COUNTIFS(A2:A100, "North", B2:B100, ">=" & DATE(2026,1,1))

The first formula counts rows where column A equals North. The second counts rows where A equals North and the date in column B is on or after Jan 1, 2026. In real sheets, you’ll mix text, numbers, and dates, and COUNTIFS handles them in a single call.

COUNTIFS Syntax Patterns

The COUNTIFS function uses pairs of range and criterion to build multi-criteria counts. The syntax is straightforward and scalable: you can add as many criterion pairs as your data requires. This makes COUNTIFS ideal for dashboards where drill-down filters are common.

Excel Formula
=COUNTIFS(criteria_range1, criterion1, [criteria_range2, criterion2, ...])

This structure lets you add as many criteria as you need. Examples:

Excel Formula
=COUNTIFS(A2:A100, "North", B2:B100, ">=" & DATE(2026,1,1))
Excel Formula
=COUNTIFS(A2:A100, "Sales*", C2:C100, "<>")

Both examples show how to combine conditions across columns. The first filters by region and a date threshold; the second uses a wildcard on text and ignores empty/non-matching statuses.

OR logic with COUNTIFS and sum

Sometimes you need A OR B conditions. COUNTIFS doesn't do OR by itself, but you can emulate it with sum of multiple COUNTIFS (or with array constants). This approach is common in lightweight dashboards where you want to report on multiple regions or categories without writing a full query.

Excel Formula
=SUM(COUNTIFS(A2:A100, {"East","West"}, B2:B100, "Active"))
Excel Formula
=COUNTIFS(A2:A100, "East", B2:B100, "Active") + COUNTIFS(A2:A100, "West", B2:B100, "Active")

Note that the first example leverages an array constant to count multiple regional conditions in a single call. The second is equivalent but explicit, which some users find easier to audit.

Complex criteria with SUMPRODUCT

When you need more than just equality or simple ranges, SUMPRODUCT shines by allowing arithmetic across multiple conditions, including numeric comparisons and non-contiguous criteria. This approach is powerful but can be harder to read at a glance, so document formulas clearly in dashboards.

Excel Formula
=SUMPRODUCT((A2:A100="North")*(B2:B100>50)*(C2:C100="Open"))

This formula counts rows where A equals North, B is greater than 50, and C equals Open. SUMPRODUCT evaluates each condition across the same row indices and returns the total count.

Using FILTER and COUNTA as a count alternative

FILTER returns the subset of rows that satisfy all conditions, and COUNTA (or ROWS) counts the resulting rows. This can be intuitive when building interactive dashboards that show live counts based on user-selected criteria.

Excel Formula
=COUNTA(FILTER(A2:A100, (A2:A100="Sales") * (B2:B100>100)))
Excel Formula
=ROWS(FILTER(A2:A100, (A2:A100="Sales") * (B2:B100>100)))

Both lines produce the same count in most data sets, with COUNTA counting non-empty values and ROWS counting the number of filtered rows.

Case sensitivity and wildcards

COUNTIFS is not case-sensitive by default, which is convenient for typical business data. If case sensitivity is required, you’ll need more advanced logic, such as using EXACT within an array context, or combining LOWER/UPPER to normalize text before comparison.

Excel Formula
=COUNTIFS(A2:A100, "north")
Excel Formula
=SUMPRODUCT(--EXACT(LOWER(A2:A100), LOWER("North")))

Wildcards can also extend matching, e.g., using * or ?. Note that wildcards apply within the criterion string for text fields.

Performance and best practices

As datasets grow, performance becomes a consideration. Prefer explicit ranges (A2:A100) over entire columns (A:A) in COUNTIFS and SUMPRODUCT. If you must use full columns, consider limiting the number of rows or using named ranges to bound calculations. This keeps sheets responsive in dashboards and reports.

Excel Formula
=COUNTIFS(Orders!A2:A100, "Open", Orders!B2:B100, ">=" & DATE(2026,1,1))

Practical examples to copy into your dashboard

These templates demonstrate common multi-criteria patterns you’ll reuse:

Excel Formula
=COUNTIFS(Orders!A2:A100, "USA", Orders!B2:B100, "Electronics", Orders!C2:C100, ">0")
Excel Formula
=SUMPRODUCT((Orders!A2:A100="USA")*(Orders!B2:B100>0)*(Orders!C2:C100="Shipped"))

Adapt ranges to your data model and replace constants with cell references for dynamic dashboards.

Debugging and common mistakes

Common issues include mismatched range sizes (criteria_range and range must have the same size) and using incompatible operators or text without quotes. Always ensure ranges align and criteria are properly quoted. If a count is unexpectedly zero, test each criterion separately to confirm which condition filters out all data.

Steps

Estimated time: 20-30 minutes

  1. 1

    Define data ranges and criteria

    Identify the columns that hold the values you want to count and write down the criteria you’ll apply (e.g., region, category, date). Decide whether to use exact matches or wildcards.

    Tip: Keep ranges stable; moving data will require updating formulas.
  2. 2

    Write a base COUNTIFS formula

    Start with a simple multi-criteria COUNTIFS to validate that each condition is recognized correctly. Use explicit ranges rather than full columns to avoid performance issues.

    Tip: Test with known values to verify accuracy.
  3. 3

    Add wildcards and dates

    Incorporate * and ? wildcards for text patterns and combine with DATE or DATEVALUE for date-based criteria. Remember to concatenate dates with DATE(year, month, day).

    Tip: Wildcard criteria like 'Sales*' can match multiple label variants.
  4. 4

    Experiment with OR logic

    COUNTIFS returns AND logic by default. To mimic OR, sum multiple COUNTIFS or use SUMPRODUCT with an array constant. Document which approach matches your needs.

    Tip: Prefer explicit sums for readability when possible.
  5. 5

    Validate results and optimize

    Cross-check counts against a manual subset. If the sheet becomes slow, reduce range sizes or switch to FILTER + COUNTA-based counts for dashboards.

    Tip: Use named ranges to simplify formulas.
Pro Tip: Keep ranges tight (A2:A100) to improve calculation speed on large datasets.
Warning: Mismatched range lengths will return #VALUE! and can silently skew counts.
Note: COUNTIFS is not case sensitive by default; use EXACT with LOWER/UPPER for case-sensitive needs.
Pro Tip: Document your criteria logic in comments or adjacent cells for future maintenance.

Prerequisites

Required

Optional

  • Understanding of logical functions (AND, OR, NOT)
    Optional
  • Sample dataset in Sheets to practice
    Optional
  • Ability to create and edit named ranges (optional)
    Optional

Keyboard Shortcuts

ActionShortcut
CopyCopy selected cell(s)Ctrl+C
PastePaste into cells or formula barCtrl+V
Fill downFill selected cell(s) with the content aboveCtrl+D
FindSearch within the sheetCtrl+F
UndoRevert last actionCtrl+Z
RedoReapply last undone actionCtrl+Y

FAQ

What is the difference between COUNTIF and COUNTIFS?

COUNTIF counts based on a single condition, while COUNTIFS can enforce multiple conditions simultaneously. For more than one criterion, COUNTIFS is the appropriate choice. If you only need a single filter, COUNTIF keeps formulas straightforward.

COUNTIF handles one condition; COUNTIFS handles several at once.

Can COUNTIFS handle date criteria?

Yes. You can compare dates using operators like >=, <=, or by combining with DATE(year, month, day). Use ranges like B2:B100 and criteria like ">=" & DATE(2026,1,1).

Date comparisons work directly in COUNTIFS.

How do I count with OR criteria in Google Sheets?

COUNTIFS uses AND logic by default. To count with OR, sum multiple COUNTIFS calls or use SUMPRODUCT with an array constant to combine conditions.

Use multiple COUNTIFS and add them, or use SUMPRODUCT for OR.

Why does COUNTIFS sometimes return zero even when data matches?

Possible causes include mismatched range sizes, incorrect criteria quotes, or extraneous spaces in data. Verify each criterion separately and ensure all ranges have identical lengths.

Check ranges and criteria for consistency.

Is there a way to count with multiple criteria that involve text and numbers together?

Yes. COUNTIFS supports mixed criteria across separate ranges, such as text in one column and numbers in another, using operators like >, <, or =. Wildcards can be used for text patterns as needed.

You can combine text and numeric criteria in COUNTIFS.

The Essentials

  • Master COUNTIFS for reliable multi-criteria counts
  • Combine COUNTIFS with SUMPRODUCT for advanced logic
  • Use FILTER/COUNTA for dashboard-friendly counts
  • Optimize by restricting ranges and using clear criteria
  • Test formulas with sample data to prevent mistakes

Related Articles