Category: FUNCTION | Updated: 2026-11-22

How to Use the COUNTIF Function in Google Sheets | Count Cells Matching a Single Criterion

How to Use the COUNTIF Function

The COUNTIF function is a statistical function that counts the number of cells within a specified range that match a single search criterion.

Syntax

=COUNTIF(range, criterion)
  • range: The cell range to test against the criterion, such as B2:B20 (required).
  • criterion: The number, text string, comparison expression, or cell reference used as the counting condition (required). Enclose text strings and comparison operators in double quotes "".

Table Example

Here is an example of counting the number of students who scored "80 or above" and the number of students in "Class A" from the test results table below.

Row Column A (Name) Column B (Class) Column C (Score)
1 Name Class Score
2 Tanaka A 85
3 Suzuki B 72
4 Sato A 90
5 Takahashi C 65
6 Ito A 80
  • Formula for scores of 80 or above: =COUNTIF(C2:C6, ">=80")
    • Result: 3 (Tanaka, Sato, and Ito)
  • Formula for Class A count: =COUNTIF(B2:B6, "A")
    • Result: 3 (Tanaka, Sato, and Ito)

Common Errors and Notes

  • Incorrectly concatenating a comparison operator with a cell reference: When counting values greater than or equal to a threshold in cell D1, writing ">=D1" treats "D1" as literal text and will not work. Always join them with an ampersand (&), like ">=" & D1.
  • Missed counts due to extra spaces or full-width characters: Even if your criterion is "A", cells containing "A " (with a trailing space) or "A" (full-width) will not match.
  • Cannot handle multiple conditions: COUNTIF accepts only one criterion. To count cells matching two or more conditions (such as “Class A and score >= 80”), use the COUNTIFS function instead.

Frequently Asked Questions

Q. How do I count cells containing specific text (partial match) with COUNTIF?

A. Use the asterisk (*) wildcard and write the criterion as "*keyword*". For example, "*Tokyo*" counts all cells containing "Tokyo", such as "Tokyo Metro" or "Tokyo Branch".

Q. How do I write comparison operators like 80 or more in COUNTIF?

A. Enclose both the comparison operator and number in double quotes, like ">=80". When combining with a cell reference, concatenate with "&", such as ">=" & D1.