Lessons › Excel & Google Sheets
Excel & Google Sheets lesson
COUNT and COUNTIF
COUNTIF counts the cells that match a condition. Plain COUNT just counts how many numbers there are.
Try this lesson free →Example
Instead of counting rows by hand, ask the sheet to count the ones that match:
=COUNTIF(C2:C9,"Lagos")| Order | Day | Store | Product | Qty | Revenue | Report | Answer | |
|---|---|---|---|---|---|---|---|---|
| O101 | Mon | Lagos | Earbuds | 2 | 70 | Orders | ||
| O102 | Mon | Abuja | Charger | 1 | 15 | Lagos orders | ||
| O103 | Tue | Lagos | Phone case | 3 | 24 | Earbuds orders | ||
| O104 | Wed | Lagos | Earbuds | 1 | 35 | Orders over 50 | ||
| O105 | Wed | Abuja | Earbuds | 4 | 140 | Abuja orders | ||
| O106 | Thu | Lagos | Charger | 2 | 30 | Orders over 100 | ||
| O107 | Fri | Abuja | Phone case | 5 | 40 | |||
| O108 | Fri | Lagos | Earbuds | 3 | 105 |
Key points
COUNTHow many numbers are in a range.
COUNTIFHow many cells match a condition.
"Lagos"The condition, in quotes. It can be text, or a test like ">50".
Put together: =COUNTIF(C2:C9,"Lagos") counts the Lagos orders.
Practice
1. In I2, count all the orders, using the Revenue column.
=COUNT(F2:F9)2. In I3, count the orders from Lagos.
=COUNTIF(C2:C9,"Lagos")3. In I7, count the orders worth more than 100. A test like "more than 100" goes in quotes too: ">100".
=COUNTIF(F2:F9,">100")4. In I4, count the Earbuds orders.
=COUNTIF(D2:D9,"Earbuds")5. In I5, count the orders worth more than 50.
=COUNTIF(F2:F9,">50")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 →