Google Sheets function · Math
COUNTIF in Google Sheets: syntax and examples
COUNTIF counts how many cells in a range match one criterion. The criterion can be a value, a comparison in quotes such as ">=10", or a pattern with wildcards. For two or more conditions use COUNTIFS.
Syntax
COUNTIF(range, criterion)
Arguments
| Argument | Type | Required | What it does |
|---|---|---|---|
range | range | yes | The cells to test. |
criterion | any | yes | The condition: a value, a comparison like ">=10", or a pattern with * and ?. |
Examples
The examples use this table, starting in A1:
| Region | Product | Qty | Status |
| North | Lamp | 12 | Shipped |
| South | Chair | 0 | Pending |
| North | Stand | 7 | Shipped |
| East | Tray | 40 | Returned |
| North | Lamp | 5 | Pending |
=COUNTIF(A2:A6, "North")Result: 3
Rows from one region. Text is matched in full, not as a fragment.
Run in a Google Sheet (English US locale) on .
=COUNTIF(C2:C6, ">=10")Result: 2
Quantities of 10 or more. The operator goes inside the quotes.
Run in a Google Sheet (English US locale) on .
=COUNTIF(B2:B6, "L*")Result: 2
Wildcard: products that start with L.
Run in a Google Sheet (English US locale) on .
=COUNTIF(A2:A6, "<>North")Result: 2
Everything except one value.
Run in a Google Sheet (English US locale) on .
=COUNTIF(C2:C6, ">"&AVERAGE(C2:C6))Result: 1
Join an operator to a calculation with &: quantities above the average.
Run in a Google Sheet (English US locale) on .
Common errors
- The match ignores case: "north" counts the same cells as "North".
- An operator must sit inside the quotes. To compare with a cell, join them: ">"&C2.
- "=0" counts cells holding zero, not blank cells. Use "" to count empty cells.
- Calling it with only the range returns #N/A. It always needs both arguments.
Compared with Excel
Same syntax and behavior as Excel COUNTIF.
Questions and answers
Can COUNTIF check two conditions?
No, it takes one criterion. COUNTIFS accepts several range and criterion pairs, and all of them must hold.