Google Sheets function · Math
COUNTIFS in Google Sheets: syntax and examples
COUNTIFS counts the rows where every condition is true. Each condition is a range and a criterion, and the pairs work as AND. For OR, add two COUNTIFS together.
Syntax
COUNTIFS(criteria_range1, criterion1, [criteria_range2, criterion2, ...])
Arguments
| Argument | Type | Required | What it does |
|---|---|---|---|
criteria_range1 | range | yes | The first range to test. |
criterion1 | any | yes | The condition for the first range: a value, a comparison such as ">100", or a pattern with * and ?. |
criteria_range2, criterion2, ... | any | no | More range and condition pairs. Every range must have the same size as the first one. |
Examples
The examples use this table, starting in A1:
| Order | Status | Country | Total |
| #1001 | paid | RO | 120 |
| #1002 | refused | RO | 80.5 |
| #1003 | paid | BG | 200 |
| #1004 | paid | RO | 45 |
| #1005 | refused | BG | 60 |
=COUNTIFS(B2:B6, "paid", C2:C6, "RO")Result: 2
Paid orders from Romania. A row is counted only if both conditions hold.
Run in a Google Sheet (English US locale) on .
=COUNTIFS(D2:D6, ">100")Result: 2
One condition with a comparison operator: totals above 100.
Run in a Google Sheet (English US locale) on .
=COUNTIFS(B2:B6, "paid", D2:D6, ">=100")Result: 2
Mix text and number conditions: paid orders worth at least 100.
Run in a Google Sheet (English US locale) on .
=COUNTIFS(D2:D6, ">80.5")Result: 2
A decimal inside the criterion follows the locale: a dot in EN, a comma in RO.
Run in a Google Sheet (English US locale) on .
=COUNTIFS(B2:B6, "<>refused", C2:C6, "R?")Result: 2
<> excludes a value and ? stands for one character, so RO matches here.
Run in a Google Sheet (English US locale) on .
Common errors
- All ranges must have the same number of rows and columns. B2:B6 next to C2:C5 returns #VALUE!.
- Conditions are joined by AND only. To count paid or refused, add two calls: COUNTIFS(...) + COUNTIFS(...).
- A comparison is written as text and a cell value is joined with &: ">"&E1. Without the & the cell address is read as plain text.
- Matching ignores case, and * and ? act as wildcards. Use ~ before them when you need a literal character.
Compared with Excel
Same syntax as Excel COUNTIFS.