Statistical · conditional count · Nov 2026

The COUNTIF function,
measured & explained.

Syntax, a live playground, a measured criteria gallery, the case-insensitivity surprise, and a sourced error library: count cells that meet one condition.

D1
fx
=COUNTIF(A2:A5, "Apple")
0
measured gallery rows
0
sourced errors fixed
0
platforms checked
// 01 — Anatomy

How COUNTIF works

Counts cells that meet one criteria. Text criteria are case-insensitive and support the wildcards * and ?.

=COUNTIF(range, criteria)
rangeRequired. The cells to count.
criteriaRequired. A number, text, operator (">150") or wildcard ("*an*"); case-insensitive.
// 02 — Conditional count

What COUNTIF actually matches

COUNTIF counts cells that meet one criteria. It is case-insensitive and supports wildcards — two facts that surprise people. Every row was measured live in HyperFormula on the sample table. Click any row to load it.

Measured criteria gallery

ExpressionResultWhy
=COUNTIF(A2:A5,"Apple")2Count cells equal to Apple
=COUNTIF(A2:A5,"*an*")1Wildcard *an* matches Banana only
=COUNTIF(B2:B5,">150")2Count amounts > 150 (200, 300)
=COUNTIF(B2:B5,">=150")3Inclusive: 150, 200, 300
=COUNTIF(D2:D5,"East")2Count the East region
=COUNTIF(A2:A5,"<>Apple")2Not-equal: Banana and Cherry
=COUNTIF(A2:A5,"?pple")2? matches one character (Apple)
=COUNTIF(A2:A5,"apple")2Case-insensitive: apple = Apple

Two surprises, measured

ExpressionResultWhy
=COUNTIF(A2:A5,"apple")2Case-insensitive: lowercase apple still matches Apple
=COUNTIF(A2:A5,"Apple")2Same count — case does not matter
=COUNTIF(A2:A5,"*")4Wildcard * counts every non-empty text cell
=COUNTIF(B2:B5,">150")2Numeric comparison criteria
⚠ COUNTIF is case-insensitive. "apple", "Apple" and "APPLE" all match. For a case-sensitive count you need SUMPRODUCT with EXACT.
Wildcards: * = any run of characters, ? = exactly one character. Escape a literal wildcard with ~ (e.g. ~*).
// 03 — Try it live

Interactive COUNTIF playground

Edit the table or type any formula — the engine evaluates instantly. Load a preset to see COUNTIF match text, operators and wildcards, and prove case-insensitivity.

A1Sample data — click any cell to edit, the formula re-evaluates live
Result
—
✓ readyHyperFormula 3.5
// 04 — Error library

The real-world error library

8 failure patterns mined from actual user reports on Reddit, Stack Overflow and Super User — each with the authentic symptom, root cause, a fix, and a runnable formula. Not textbook theory.

// 05 — Cross-platform

Where COUNTIF works

COUNTIF is available across modern Excel, Google Sheets and LibreOffice. It has been in Excel since 2003.

PlatformSupportNotesGotcha
✓ Supported full COUNTIF◐ Partial works with caveatsCompiled from public docs · verify against your build
// Go deeper

Master conditional math

COUNTIF is one piece. The full course walks the toolkit end to end with live, measured examples.

  • COUNTIF / SUMIF — one condition
  • COUNTIFS / SUMIFS — many conditions
  • Wildcards * and ? and the ~ escape
  • Case-insensitivity and the EXACT fix
Free while in beta
Browse the function library

No account needed. Every page has a live playground.

// 07 — FAQ

Frequently asked