← Excel and spreadsheets

COUNTIF

Count only the cells that match a condition.

Start this lesson

=COUNTIF(range, condition) counts the cells in the range that match. The condition can be text, like "East", or a comparison in quotes, like ">500" or "<=20". COUNTIFS takes several range and condition pairs and counts rows that match them all.

Example: =COUNTIF(C2:C9,">500") with sales of 420, 610, 500, 730, 390, 880, 505 and 260

  1. 610, 730, 880, 505 — Values more than 500
  2. 500 does not count — > means strictly greater
  3. 4 — COUNTIF returns 4

Why it works: COUNTIF runs the same test on every cell in the range and adds one for each cell that passes, which is exactly how you would tally by hand.

Tip: Text conditions ignore capital letters: "east" and "East" match the same cells.