BBampaa

Lessons › Excel & Google Sheets

Excel & Google Sheets lesson

COUNTIF

COUNTIF counts the cells that match a condition: 5 Lagos orders.

Try this lesson free →
About 5–10 minutes · no sign-up needed

Example

Instead of counting rows by hand, ask the sheet to count the ones that match:

=COUNTIF(C2:C9,"Lagos")

Typed into cell I2 of this sheet:

OrderDayLocationProductQtyRevenueReportAnswer
O101MonLagosEarbuds270Lagos orders
O102MonAbujaCharger115Earbuds orders
O103TueLagosPhone case324Orders over 50
O104WedLagosEarbuds135Abuja orders
O105WedAbujaEarbuds4140Orders over 100
O106ThuLagosCharger230Charger orders
O107FriAbujaPhone case540
O108FriLagosEarbuds3105

Key points

COUNTIFHow many cells match a condition.
C2:C9First, the range to check: the Location column.
"Lagos"Then what to look for, in quotes. It can be a test too, like ">50".

Put together: =COUNTIF(C2:C9,"Lagos") counts the Lagos orders.

Practice

Try each one in your head first, then open the answer.

1. In I3, count the Earbuds orders.
=COUNTIF(D2:D9,"Earbuds")
2. In I6, count the orders worth more than 100. A test like "more than 100" goes in quotes too: ">100".
=COUNTIF(F2:F9,">100")
3. In I4, count the orders worth more than 50.
=COUNTIF(F2:F9,">50")
4. In I5, count the orders from Abuja.
=COUNTIF(C2:C9,"Abuja")
5. In I7, count the Charger orders.
=COUNTIF(D2:D9,"Charger")

Learn it by doing. This lesson is a short hands-on level on Bampaa: see it work, then build and write it yourself, with instant feedback.

Try this lesson free →
About 5–10 minutes · no sign-up needed