Skip to main content

Conditional formula page

COUNTIF Formula

Use COUNTIF when one column decides whether a row should be counted.

Best for

Count matching rows with COUNTIF.

What it returns

With the sample data, this counts completed tasks.

Copy formulas

Excel formula
=COUNTIF(C2:C100, "Complete")
Google Sheets formula
=COUNTIF(C2:C100, "Complete")
Excel / Google Sheets difference

Excel and Google Sheets both use COUNTIF for one condition. It counts matching cells or rows, so it does not total a separate Hours column.

Example data

TaskOwnerStatusDue DateHours
Import leadsMayaComplete2026-01-063
Clean headersNicoIn Progress2026-01-082
Review budgetMayaComplete2026-01-124
Publish reportIrisBlocked2026-01-151
What it returns

With the sample data, this counts completed tasks.

How the formula works

  • C2:C100 is the range being checked.
  • Complete is the criteria.
  • The result is a count, not a total amount.
Syntax pieceRole in the formula
C2:C100The Status range checked for the requested condition.
"Complete"The criterion that selects completed rows.
COUNTIFReturns a count of matches and does not add numeric values from another column.

Verified examples

Count Complete tasks
=COUNTIF(C2:C100, "Complete")

Excel: Use the sample task table with two Complete values in C2:C100. Returns: 2

Criteria stored in a cell
=COUNTIF(B2:B100, F2)

Google Sheets: Enter Maya in F2; two Owner cells in B2:B100 contain Maya. Returns: 2

Task names beginning with Import
=COUNTIF(A2:A100, "Import*")

Excel: Use the sample task names in A2:A100, with one name beginning Import. Returns: 1

Common errors and fixes

IssueLikely causeFix
A wildcard criterion matches the wrong task namesAn asterisk matches any sequence, while a literal asterisk needs a tilde escape.Use Import* for a prefix match and ~* when the asterisk itself must be matched.
A visible Complete value is not countedThe cell contains hidden spaces or another nonprinting character; case differences are not the cause because COUNTIF ignores case.Trim or clean the source status values before applying the criterion.
Two conditions are needed but COUNTIF cannot express themCOUNTIF accepts one range-and-criterion pair only.Switch to COUNTIFS and add one aligned range-and-criterion pair for each condition.

When not to use this formula

  • Do not use COUNTIF when the result must add amounts or enforce multiple independent conditions.

Alternatives

AlternativeWhen to use it
COUNTIFS FormulaUse when the count must satisfy two or more conditions at the same time.
COUNTIFS Formula BuilderUse when criteria need to be configured interactively before copying the formula.

Related formulas

Official references

FAQ

Is COUNTIF case-sensitive?

No. COUNTIF treats uppercase and lowercase letters as equal when comparing text.

How do COUNTIF wildcards work?

An asterisk matches any sequence of characters; prefix it with a tilde when a literal asterisk should be matched.