Lessons › Excel & Google Sheets
Excel & Google Sheets lesson
IF
F2 is 70, which is more than 50, so the sheet shows Big.
Try this lesson free →Example
IF runs a test, then shows one answer if it's true and another if it's false:
=IF(F2>50,"Big","Small")| Order | Day | Store | Product | Qty | Revenue | Label |
|---|---|---|---|---|---|---|
| O101 | Mon | Lagos | Earbuds | 2 | 70 | |
| O102 | Mon | Abuja | Charger | 1 | 15 | |
| O103 | Tue | Lagos | Phone case | 3 | 24 | |
| O104 | Wed | Lagos | Earbuds | 1 | 35 | |
| O105 | Wed | Abuja | Earbuds | 4 | 140 | |
| O106 | Thu | Lagos | Charger | 2 | 30 | |
| O107 | Fri | Abuja | Phone case | 5 | 40 | |
| O108 | Fri | Lagos | Earbuds | 3 | 105 |
Key points
F2>50The test: is the revenue more than 50?
"Big"What to show if the test is true.
"Small"What to show if it's false. Text always goes in quotes.
Put together: =IF(F2>50,"Big","Small"). Tests can use > < >= <= = and <>.
Practice
1. In G3, label order O102 Big if its revenue is over 50, otherwise Small.
=IF(F3>50,"Big","Small")2. In G4, show Local if the store is Lagos, otherwise Ship.
=IF(C4="Lagos","Local","Ship")3. In G5, show Bulk if the quantity is 3 or more, otherwise Single.
=IF(E5>=3,"Bulk","Single")4. In G6, show Over 100 if the revenue is more than 100, otherwise Under 100.
=IF(F6>100,"Over 100","Under 100")5. In G9, show Yes if the product is Earbuds, otherwise No.
=IF(D9="Earbuds","Yes","No")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 →