WorkbookLogic
FunctionStatisticalintermediateCOUNTIFIF

COUNTIF Function

By WorkbookLogic

The Excel COUNTIF function counts cells that meet one condition. It works with text, numbers, dates, comparison operators, blanks, and wildcard patterns.

ExcelLast reviewed Sep 11, 2026
countif-function-v1.0.0.xlsx
Excel COUNTIF Function
Count records that meet one criterion; edit the source data and criteria to see each count update.
Source data, editableCOUNTIF examples
RegionStatusAmountExampleCriterionFormula syntaxResult
NorthOpen1,200.0Records in selected regionNorth=COUNTIF(A12:A21,F12)4
SouthClosed850.0Records with selected statusOpen=COUNTIF(B12:B21,F13)4
NorthOpen1,450.0Amounts above threshold>1000=COUNTIF(C12:C21,F14)5
WestPending0.0Nonblank status cells<>=COUNTIF(B12:B21,F15)9
EastClosed1,100.0
North760.0How to read the examples
SouthOpen1,325.0The criteria range decides which rows qualify.
WestClosed-100.0The editable criterion can be text, a number, or an operator expression.
NorthPending980.0The result updates when source values or the criterion changes.
EastOpen1,500.0
Reliability checks
Region count agrees with a direct equality testOK
Blank status is excluded from the nonblank countOK

Overview

The Excel COUNTIF function counts cells that satisfy one rule. Use it for questions such as how many orders are open, how many amounts exceed a threshold, or how many cells are not blank.

Quick reference

Syntax: =COUNTIF(range, criteria)

Returns: The number of cells in the range that satisfy the criterion. (number)

Arguments:

  • range (required) — The cells Excel evaluates and counts.
  • criteria (required) — The text, number, expression, cell reference, or wildcard pattern that determines which cells count.

Both arguments are required. The criterion may be a number, text value, expression, cell reference, or wildcard pattern, with operators such as > written inside quoted criteria text.

Common uses

  • Count records in one category, region, owner, or workflow status.
  • Count amounts above or below a visible threshold.
  • Measure blanks or completed fields in a data-quality check.
  • Count text that begins with, ends with, or contains a pattern.

Calculations

COUNTIF tests every cell in range against the same criterion and returns the number of matches. It applies one condition only; use COUNTIFS when the same record must pass two or more conditions.

Plain text or a direct numeric value can be supplied as the criterion. Comparison operators must be text, so a fixed threshold is written as ">1000". When the threshold comes from another cell, join the operator to the reference, as in ">"&F14. Do not put the cell reference itself inside quotation marks.

Text matching is not case-sensitive. The wildcard * matches any sequence of text characters, ? matches one character, and ~ escapes a literal wildcard. COUNTIF expects a worksheet range for its first argument; an array calculated by another function is not a direct substitute.

Function behavior

Situation

Behavior

No matches

Returns 0.

Text case

Matching is not case-sensitive.

Blank criterion

"" targets blank cells; "<>" targets cells that are not blank.

Comparison operators

Operators such as >, <=, and <> must be enclosed in quotes and concatenated when used with a cell reference.

Wildcards

* matches any text sequence, ? matches one text character, and ~ escapes a wildcard.

Dates

Dates can be compared as Excel serial numbers; a cell reference or DATE is safer than a locale-dependent text date.

Errors

Error cells are counted only if the criterion targets that error; an invalid formula or unsupported reference can return an error.

Calculated arrays

range must be an actual range rather than an array returned by another function.

Common errors

Leaving a comparison operator unquoted

What happens:
Excel cannot interpret a criterion such as >1000 when it is entered directly as formula syntax.

Better approach:
Use ">1000", or concatenate a reference with ">"&F14.

Putting a cell reference in quotation marks

What happens:
"F14" is treated as literal text instead of the value stored in cell F14.

Better approach:
Use F14 for an equality test or concatenate it to an operator.

Trying to apply several conditions with one COUNTIF

What happens:
The formula can test only one range-condition pair.

Better approach:
Use COUNTIFS for AND logic across multiple criteria ranges.

Including a header in the range

What happens:
The header can become an unintended match, especially with text or wildcard criteria.

Better approach:
Start the range at the first data row and keep its boundaries explicit.

Example

Example 1 — Count a Text Value

=COUNTIF(A12:A21,F12)

With North in F12, this formula counts the matching region cells. The example workbook returns 4.

Example 2 — Count a Status

=COUNTIF(B12:B21,F13)

This applies the value in F13 to the Status range. With Open selected, the result is 4.

Example 3 — Count Values Above a Threshold

=COUNTIF(C12:C21,F14)

In the workbook, F14 contains the criterion >1000. Five amounts satisfy that comparison.

Example workbook

The workbook contains a COUNTIF Example sheet with ten editable Region, Status, and Amount records. Four live formulas demonstrate text, comparison, and nonblank criteria, while two checks reconcile the visible region count and blank handling. A Notes sheet summarizes syntax and criteria rules.

Key takeaway

Use COUNTIF for one visible condition, and write operator-based criteria as text or as an operator concatenated to a cell reference.