Skip to content

Excel function guide · Conditional sums & counts

COUNTIF function in Excel

COUNTIF counts how many cells in a range meet one condition, for example how many people are in Sales or how many scores are 70 or more.

Syntax

=COUNTIF(range, criteria)
ArgumentRequired?What it means
rangeRequiredThe cells to count.
criteriaRequiredThe condition: a value ("Sales"), a cell, a comparison in quotes (">=70") or a wildcard pattern ("*a*").

COUNTIF examples

Every example uses this small table. The results are what Excel shows in the cell.

ABC
1NameDepartmentScore
2HanaSales82
3OmarFinance67
4LuciaSales91
5TomHR58
6MeiSales74
7RajFinance88
  1. 1. Count a text value

    =COUNTIF(B2:B7, "Sales")

    Result: 3

    Three people are in Sales. Case doesn't matter: "sales" gives the same answer.

  2. 2. Count with a comparison

    =COUNTIF(C2:C7, ">=70")

    Result: 4

    Scores of 70 or more: 82, 91, 74 and 88.

  3. 3. Count with a wildcard

    =COUNTIF(A2:A7, "*a*")

    Result: 4

    Names containing an a anywhere: Hana, Omar, Lucia and Raj. * stands for any characters.

Try it now

Practise COUNTIF in a live sheet.

Type each formula yourself. Answers are checked by the same engine as the full course. No account needed.

Try it · COUNTIF
0 XP
E3
A
B
C
D
E
F
1
Name
Department
Score
Question
Answer
2
Hana
Sales
82
Department
Finance
3
Omar
Finance
67
People in E2
4
Lucia
Sales
91
Scored 80+
5
Tom
HR
58
Pass mark
70
6
Mei
Sales
74
Below E5
7
Raj
Finance
88
8
Double-click or start typing to edit

Step 1 of 3

In E3, count the people in the department named in E2.

Common COUNTIF mistakes

Practise this in Excel Quest

COUNTIF & SUMIFFree

Course 5 · Conditional Aggregation · 11 min

Count and total only the rows that match — then build a region summary that reconciles to the total.

This lesson is free: create an account and it opens straight away.

Related functions

All Excel function guides