COUNTIF

Count cells that meet certain criteria.

Parameter List

Syntax
COUNTIF(rangecriterion)
range

A range of values you want to count. For example: A1:A5.

criterion

The pattern or test to apply to range. For example: 5, ">5", or "spreadsheet".

More details

You can use wildcards in criterion. To match any singular character, use ?. To match zero or more characters, use *. If you want to match an actual question mark or asterisk, prefix it with a tilde. For example: "What~?".

If criterion is a number, each cell in range is checked to see if it is equal to criterion. If you want to use operators, such as > or >=, you need to enclose your criterion in quoatation marks.

Examples

COUNTIF(A1:A5, ">20") returns 2Example 1