BBampaa

Lessons › Excel & Google Sheets

Excel & Google Sheets lesson

COUNTIFS

Three rows have Lagos in the Store column and Earbuds in the Product column: O101, O104 and O108.

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

Example

COUNTIF counts rows that match one condition. COUNTIFS counts rows that match all of them:

=COUNTIFS(C2:C9,"Lagos",D2:D9,"Earbuds")

Typed into cell I2 of this sheet:

OrderDayStoreProductQtyRevenueReportAnswer
O101MonLagosEarbuds270Lagos Earbuds orders
O102MonAbujaCharger115Lagos orders over 50
O103TueLagosPhone case324Abuja orders over 30
O104WedLagosEarbuds135Earbuds orders over 50
O105WedAbujaEarbuds4140Lagos orders of 3+
O106ThuLagosCharger230
O107FriAbujaPhone case540
O108FriLagosEarbuds3105

Key points

C2:C9,"Lagos"A range to check, then what to look for.
D2:D9,"Earbuds"Add another pair for each extra condition. Every pair has to match.
F2:F9,">50"Conditions can be tests too, in quotes.

Unlike SUMIFS, there's no range to add up: =COUNTIFS(C2:C9,"Lagos",F2:F9,">50").

Practice

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

1. In I2, count the Earbuds orders from Lagos.
=COUNTIFS(C2:C9,"Lagos",D2:D9,"Earbuds")
2. In I3, count the Lagos orders worth more than 50.
=COUNTIFS(C2:C9,"Lagos",F2:F9,">50")
3. In I4, count the Abuja orders worth more than 30.
=COUNTIFS(C2:C9,"Abuja",F2:F9,">30")
4. In I5, count the Earbuds orders worth more than 50.
=COUNTIFS(D2:D9,"Earbuds",F2:F9,">50")
5. In I6, count the Lagos orders with a quantity of 3 or more.
=COUNTIFS(C2:C9,"Lagos",E2:E9,">=3")

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