How to Use COUNTIF in Google Sheets

By Tomosuke Hasegawa · Updated Oct 29, 2026 · Beginner · 6 min read · includes 2 free exercises

In short: COUNTIF counts the cells in a range that meet one condition. For example, it can count how many tasks are marked Done. The formula is =COUNTIF(range, criterion).

What COUNTIF does

COUNT only counts numbers. COUNTIF counts the cells that meet a test you set, whether the cells hold text or numbers. You use it when you want to know how many times something appears: how many orders are open, how many people are on a team, how many scores are above a target.

COUNTIF syntax

=COUNTIF(range, criterion)

COUNTIF supports one criterion. To test several conditions at once, use COUNTIFS. Matching is not case sensitive, so "done" and "Done" count the same cells.

A step-by-step example

Here is a small task list in cells A1:D8.

ABCD
1TaskOwnerStatusHours
2Write reportAnnDone3
3Fix bugBenOpen5
4Send invoiceAnnDone2
5Plan tripCaraOpen6
6Update docsBenDone4
7Review PRAnnOpen1
8Test appBenDone8

To count the tasks with the status Done:

=COUNTIF(C2:C8, "Done")

This returns 4. Here is why:

  1. Sheets checks each cell in C2:C8 and finds the ones equal to "Done".
  2. Those are in rows 2, 4, 6 and 8.
  3. It counts them: 4.

A text criterion goes in quotation marks.

Use comparison operators

For numbers, put an operator in front of the value inside the quotation marks. To count the tasks that take more than 4 hours:

=COUNTIF(D2:D8, ">4")

This returns 3 (the 5, 6 and 8 hour tasks). Google's help page lists these operators: =, >, >=, < and <=. A plain number such as 4 checks for equality.

To compare with a value in a cell, join the operator and the reference with an ampersand. If F1 holds 4, then =COUNTIF(D2:D8, ">"&F1) gives the same result.

Use wildcards for partial matches

In a text criterion, ? matches any single character and * matches zero or more characters. To count the tasks whose name starts with "Re":

=COUNTIF(A2:A8, "Re*")

This returns 1 (Review PR). To match a literal ?, * or ~, put a tilde in front of it, as in "~?".

Common COUNTIF mistakes

Try it yourself

Use the task list above (A1:D8). Type your formula into the box, starting with =, then press Check.

Exercise 1: Count by status

Write a formula that counts how many tasks have the status Done (column C).

Hint: test C2:C8 against "Done".

Exercise 2: Count long tasks

Write a formula that counts how many tasks take more than 4 hours (column D).

Hint: the criterion is the text ">4".

What to learn next

Syntax and rules in this guide were checked against Google's COUNTIF help page. See all guides.