ExcelUnpackUnpack Excel, one formula at a time.
Log inSign up

Lesson 18 · Count functions

COUNTIF in Excel

COUNTIF counts only the cells that match what you ask for. =COUNTIF(B2:B9,"West") counts the West rows. You can also count numbers bigger or smaller than a value.

Practice this lesson →Pro lesson. The first 4 lessons are free.

What you will learn

  • Count the cells that match
  • Write what to look for: words, numbers or comparisons

How it works

COUNTIF(range, criteria) counts the cells that match.

  • Words: "West"
  • Comparisons, in quotes: ">500"
  • Or a cell name, like F2

Capital letters don't matter. "west" matches "West".

Formulas at a glance

=COUNTIF(B2:B9,"West")equals
=COUNTIF(C2:C9,">500")comparison

Example

Write the formula to count how many orders came from the West.

ABCDEFG
1OrderRegionAmountStatusQuestionAnswer
21001West820ShippedWest orders
31002East240PendingOrders over 500
41003North510ShippedShipped orders
51004West130ShippedPending orders
61005South975PendingOrders under 300
71006East660Shipped
81007West390Pending

Click G2 and type =COUNTIF(B2:B9,"West"), then press Enter.

The answer is 3.

When to use it

  • How many orders came from one region
  • How many scores are over 80
  • How many tasks say "Done"

Common mistakes

  • Leaving out the quotesWords and signs go in quotes: "West", ">500".
  • Putting a space inside the quotes"West " with a space doesn’t match "West".
  • Using COUNTIF for two conditionsUse COUNTIFS when there is more than one condition.

Quick check

Which formula counts cells in A1:A20 that are more than 50?

  1. =COUNTIF(A1:A20,>50)
  2. =COUNTIF(A1:A20,">50")
  3. =COUNT(A1:A20>50)
  4. =COUNTIF(">50",A1:A20)
Show the answer

B. =COUNTIF(A1:A20,">50") Comparisons go inside quotes.

Practice it on a real sheet

Reading is a start. Doing it is how it sticks. This lesson walks you through every click on a live spreadsheet and checks each answer.

COUNTIF in Excel: how it works, with examples · ExcelUnpack