COUNTIF
Counts cells in a range that satisfy a single criterion.
COUNTIF evaluates each candidate cell against one criteria expression.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=COUNTIF(range, criteria)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
range | any | Required | — |
criteria | any | Required | — |
Differences from Excel
Formualizer accepts an array constant as the range. Excel requires a reference.
Remarks
- An equality criterion for a date or number (
"10/26/1999","36459",36459) also matches text cells holding that date;<>and ordering criteria do not read date text. - Criteria support numeric comparisons and wildcard text matching.
- Matching is case-insensitive for text criteria.
- Non-matching or blank cells are not counted.
Examples
Count records equal to a region label.
Formula =COUNTIF(A1:A4,"East")
| A | |
|---|---|
| 1 | "East" |
| 2 | "West" |
| 3 | "East" |
| 4 | "Northeast" |
Expected result 2
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Use a wildcard to include labels with the same ending.
Formula =COUNTIF(A1:A4,"*east")
| A | |
|---|---|
| 1 | "East" |
| 2 | "West" |
| 3 | "East" |
| 4 | "Northeast" |
Expected result 3
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
A criterion matching no cell produces a zero count.
Formula =COUNTIF(A1:A4,"South")
| A | |
|---|---|
| 1 | "East" |
| 2 | "West" |
| 3 | "East" |
| 4 | "Northeast" |
Expected result 0
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Count numbers greater than 10
Formula =COUNTIF(A1:A3, ">10")
| A | |
|---|---|
| 1 | 5 |
| 2 | 15 |
| 3 | 22 |
Expected result 2
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Date criterion matches date text
Formula =COUNTIF(A1:A3, "10/26/1999")
| A | |
|---|---|
| 1 | "10/26/1999" |
| 2 | "1999-10-27" |
| 3 | 36459 |
Expected result 2
This example uses behavior that differs in the published browser package.
Related functions
FAQ
Is COUNTIF text matching case-sensitive?
No. Text criteria matching is case-insensitive.
Can COUNTIF evaluate wildcard criteria?
Yes. Criteria expressions support wildcard patterns for text.