How to use the COUNTIF function

The COUNTIF function counts the number of cells within a given range that meet a given criteria.

Syntax
COUNTIF(range,criteria)

Range: The range of cells from which you want to count cells.

Criteria: The criteria upon which you want to base your count. It defines which cells will be counted.
The criteria can b a number, expression, cell reference, or a text.

Examples:

=COUNTIF(B15:B33;”>100″)
=COUNTIF(A1:A8;”ABC”)

The examples below show how to use COUNTIF with numeric values. A1 to A6 is our data range. In rows 7, 8 and 9 you have the text of the formula  in column A (for explanation only), the actual formula in column B and column C shows which cells are qualified to be counted.

COUNTIF and wildcards

You can use the wildcard characters question mark (?) and asterisk (*) in the COUNTIF criteria. A question mark matches any single character; an asterisk matches any sequence of characters.

Examples:

The examples below show how to use COUNTIF with wildcards. A1 to A11 is our data range. In rows 12, 13, 14, 15 and 16 you have the text of the formula  in column A (for explanation only),  the actual formula in column B, and column C shows which cells are qualified to be counted.

Note:

If you want to find an actual question mark or asterisk, type a tilde (~) before the character.

Related posts:

  1. How to use the Match function
  2. How to count blank or empty cells in a range
  3. How to count cells that contain numbers or dates