COUNTIF function
The COUNTIF function counts the number of cells in a range that meet a specified criteria.
Syntax
COUNTIF(cell number..cell number, criteria)
Parameters
Cell numbers - The first and last numbers of the cell range. The calculation includes these numbers and all numbers in between.
Criteria - The value a cell must contain to be counted. Supported criteria include:
- Cell number
- String (in quotations)
Example | Description |
---|---|
COUNTIF(C1..C10,C2) |
Counts the number of cells in the range with the same value as cell C2. |
COUNTIF(C1..C10,">5") |
Counts the number of cells in the range with a value greater than 5. |
COUNTIF(C1..C10,"apple") |
Counts the number of cells in the range containing apple. |
COUNTIF(C1..C10,"app*") |
Counts the number of cells in the range containing text starting with app. |
COUNTIF(C1..C10,"?????es") |
Counts the number of cells in the range that have exactly 7 characters, and end with the letters es. |
COUNTIF(C1..C10,">1/14/2020") |
Counts the number of cells in the range with a date greater than 1/14/2020. |
COUNTIF(C1..C10,">"+MKSTR(C3)) | Counts the number of cells in the range with a value greater than cell C3. |