Home / Guides / How to Use COUNTIF and COUNTIFS in Excel

How to Use COUNTIF and COUNTIFS in Excel

Excel Functions · Updated June 2026

COUNTIF counts the cells in a range that meet one condition, and COUNTIFS extends that to several conditions at once. In financial models they tally transactions by status, count accounts that breach a threshold, or measure how many periods met a target. They turn raw transaction tabs into summary counts without a pivot table and refresh the moment the underlying data changes.

Syntax and how they work

COUNTIF is =COUNTIF(range, criteria). It scans range and counts the cells matching criteria, which can be a value, a cell reference, or a comparison in quotes such as ">=1000".

COUNTIFS is =COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2], ...). Each criteria range pairs with its own criterion, and the conditions combine with AND logic, so a row must satisfy every pair to be counted. Every criteria range must span the same rows, or COUNTIFS returns a #VALUE! error.

Worked example: count open invoices over a threshold

A ledger has status labels in B2:B200 and amounts in D2:D200. You want the number of invoices that are both open and at or above 1000. That is two conditions, so COUNTIFS is the right tool.

  1. Enter =COUNTIFS(B2:B200, "Open", D2:D200, ">=1000").
  2. COUNTIFS checks B2:B200 for Open and D2:D200 for values at or above 1000.
  3. Only rows where both conditions hold are counted, combining with AND logic.
  4. To reference a threshold cell instead of a literal, concatenate the operator: ">="&H1.
Status (B)Amount (D)Counted?
Open1500
Paid2000
Open800
Open3000

Two rows are both Open and at or above 1000, so the result is 2.

Criteria syntax that earns its keep

Criteria are more expressive than a plain value. Comparison operators count ranges of numbers, wildcards match partial text, and references let the criterion live in a cell so the summary updates as inputs change.

Getting the quoting right is the whole game: operators and wildcards go inside quotes, while a cell reference is concatenated with &.

Common pitfalls in models

Mismatched range sizes are the top COUNTIFS error. Every criteria range must span exactly the same rows, so B2:B200 paired with D2:D199 throws #VALUE!. Lock ranges with absolute references like $B$2:$B$200 before copying so they do not drift.

The second trap is OR logic. COUNTIFS combines conditions with AND only, so to count rows that are Open OR Overdue you add two COUNTIF results, taking care not to double count any row that matches both. Text mismatches such as a trailing space in "Open " versus "Open" also undercount silently, since the strings are not equal.

Do it in one click

Formula Trace

Formula Trace reveals the ranges a COUNTIFS reads so you can confirm it counts the right columns and rows.

Get ModelMint See how it works

FAQ

What is the difference between COUNTIF and COUNTIFS?

COUNTIF counts cells against a single condition. COUNTIFS supports multiple conditions that combine with AND logic, so a row must satisfy every criteria pair to be counted. For models, standardize on COUNTIFS so the pattern is consistent.

How do I count cells with an OR condition?

COUNTIFS only does AND logic. Add separate COUNTIF or COUNTIFS results together, one per condition, and subtract any overlap so rows matching both conditions are not counted twice.

Why is my COUNTIFS returning zero when matches exist?

Check for trailing spaces or different data types between the criteria and the data, since the comparison must be exact. Also confirm every criteria range spans the same rows, because mismatched sizes return a #VALUE! error rather than a count.