COUNTIFS Formula Generator — Multiple Criteria in Excel & Sheets | SheetMaster

Counts cells that meet multiple criteria. Essential for data analysis with complex conditions.

Generated Formula
=COUNTIFS(criteria_range1, criteria1, criteria_range2, criteria2)

Learning Resources

Want to master Excel? Check out this Top-Rated Course.

Master COUNTIFS: Count with Multiple Conditions

The COUNTIFS function counts rows that meet multiple criteria across different columns. It is the multi-condition version of COUNTIF and one of the most versatile functions for data analysis in Excel and Google Sheets.

Step-by-Step: Using COUNTIFS for the First Time

Let us walk through a concrete example. Imagine you have a sales table:

  • Column A: Region (East, West, North)
  • Column B: Sales Amount (e.g. 250, 750, 1200)
  • Column C: Status (Completed, Pending)

Goal: Count how many "Completed" orders in the "East" region exceeded $500.

=COUNTIFS(A:A, "East", B:B, ">500", C:C, "Completed")

Each pair (range, criteria) adds one filter. Only rows matching ALL three conditions are counted.

COUNTIF vs COUNTIFS: What is the difference?

COUNTIF handles one condition only. COUNTIFS handles two or more conditions simultaneously. Every condition is connected by AND logic—all conditions must be true for a row to be counted.

Feature COUNTIF COUNTIFS
Conditions Single condition Multiple (AND)
Syntax =COUNTIF(range, criteria) =COUNTIFS(range1, cr1, range2, cr2)
Max criteria pairs 1 127
OR logic Not supported Requires multiple formulas

Real-World Use Cases

  • Sales Reporting: Count orders where region = "East" AND amount > $500.
  • HR Analytics: Count employees in department "Engineering" with tenure > 3 years.
  • Inventory: Count products in category "Electronics" where stock < 10 (needs restocking).
  • Education: Count students who scored above 80 in Math AND above 70 in Science.
  • Customer Support: Count tickets tagged "Urgent" that are still "Open" and overdue by 3+ days.

Working with Date Ranges

To count rows where a date falls within a specific range, use two conditions on the same date column:

=COUNTIFS(A:A, ">="&DATE(2026,1,1), A:A, "<="&DATE(2026,3,31))

For dynamic dates stored in cells, reference them directly:

=COUNTIFS(A:A, ">="&D1, A:A, "<="&E1)

Advanced: COUNTIFS with OR Logic

COUNTIFS uses AND logic by default. To implement OR, add multiple COUNTIFS together:

=COUNTIFS(A:A, "East", B:B, ">500") + COUNTIFS(A:A, "West", B:B, ">500")

This counts rows where (Region = East AND Sales > 500) OR (Region = West AND Sales > 500).

Common Errors & Troubleshooting

  • COUNTIFS returns 0: Likely causes: range sizes mismatch, text criteria not in quotes, or no data matches all conditions simultaneously.
  • #VALUE! error: Usually means criteria ranges have different dimensions (e.g. A1:A100 paired with B1:B99). Ensure every range has the same row count.
  • Counting blank cells: Use =COUNTIFS(A:A, "") for truly empty cells. Use =COUNTIFS(A:A, "") + COUNTIFS(A:A, "* ") to include blank-looking cells with only spaces.
  • Cell contains numbers as text: If your criteria range stores numbers as text, use TEXT function: =COUNTIFS(A:A, TEXT(500, "0")).

Important: All criteria ranges must be the same size. If range1 is A1:A100, range2 must also be 100 rows. Mismatched sizes cause incorrect counts or #VALUE! errors.

Common Errors & Fixes

  • COUNTIFS returns 0 or unexpected count

    Causes:
    • Criteria ranges have different lengths.
    • Text criteria not in quotes; number criteria wrong format.
    Fixes:
    • Use identical range sizes: A1:A100, B1:B100.
    • Use "Completed", ">100", "="&A1 for text, number, and cell reference.

Frequently Asked Questions

How to use COUNTIFS with multiple criteria?

Syntax: =COUNTIFS(criteria_range1, criteria1, criteria_range2, criteria2, ...). Example: =COUNTIFS(A:A, "East", B:B, ">500", C:C, "<>") counts rows where region is East, amount > 500, and category is not blank.

Why does my COUNTIFS return 0?

Three most common causes: (1) Criteria ranges differ in size — all ranges must have the same row count. (2) Text values missing quotes — use "Completed" not Completed. (3) No rows match ALL conditions — test with fewer criteria to isolate.

How do I use COUNTIFS with date ranges in Excel?

Use two conditions on the same date column: =COUNTIFS(A:A, ">="&DATE(2026,1,1), A:A, "<="&DATE(2026,3,31)). For single cell dates, reference them: =COUNTIFS(A:A, ">="&D1, A:A, "<="&E1).

Can COUNTIFS use OR logic instead of AND?

COUNTIFS is AND-only. For OR logic, add multiple COUNTIFS together: =COUNTIFS(A:A, "X", B:B, "Y") + COUNTIFS(A:A, "Z", B:B, "Y"). Or use SUMPRODUCT for complex logic.

How do I count blank or non-blank cells with COUNTIFS?

Use "" for blank and "<>" for non-blank: =COUNTIFS(A:A, "", B:B, "<>") counts rows where A is blank AND B is not blank. This is useful for data quality checks.

COUNTIFS with wildcards — how does it work?

Use * for any sequence of characters and ? for a single character: =COUNTIFS(A:A, "*North*", B:B, "???-???"). This counts rows where A contains "North" and B has a pattern like "ABC-12".

What if my criteria range and criteria are in another sheet?

Reference another sheet normally: =COUNTIFS(Sheet2!A:A, "East", Sheet2!B:B, ">100"). The sheet name with space must be in quotes: =COUNTIFS('Sheet 2'!A:A, "East").

COUNTIFS vs COUNTIF — what is the difference?

COUNTIF handles exactly ONE condition. COUNTIFS handles 1+ conditions (up to 127 pairs). Always prefer COUNTIFS even for single conditions — if you later add a second condition, the syntax stays consistent.

How do I count rows where a date falls between two dates using COUNTIFS?

Use two conditions on the same date column: =COUNTIFS(A:A,">="&DATE(2026,1,1),A:A,"<="&DATE(2026,3,31)). This counts all rows where column A has a date between Jan 1 and Mar 31, 2026.

Can COUNTIFS handle wildcards for partial text matches?

Yes. Use * for any characters and ? for a single character: =COUNTIFS(A:A,"*North*") counts cells containing 'North' anywhere in the text. Combine with other criteria: =COUNTIFS(A:A,"*North*",B:B,">100").

What is the maximum number of criteria pairs COUNTIFS supports?

COUNTIFS supports up to 127 criteria pairs in Excel 2007+. Each pair consists of a range and a criteria. For example: =COUNTIFS(A:A,"X",B:B,">5",C:C,"<>Y",D:D,"<100").

Related Formulas

Explore related formula generators to solve similar problems

Want to become an Excel Pro?

Stop searching for formulas. Master Excel in 30 days with this top-rated course.

Learn More