Lessons › Excel & Google Sheets
Excel & Google Sheets lesson
IF with OR
O101 is Earbuds, so the first test passes and the sheet shows Promote, even though it's worth only 70.
Try this lesson free →Example
OR is TRUE when at least one test inside it is true. Use it as the test inside IF:
=IF(OR(D2="Earbuds",F2>100),"Promote","Skip")| Order | Day | Location | 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
OR(test1, test2)TRUE if at least one test is true.
D2="Earbuds"One test. Each test goes inside OR, separated by a comma.
IF(OR(...),"Promote","Skip")Put OR where IF's test goes.
Put together: =IF(OR(D2="Earbuds",F2>100),"Promote","Skip"). AND needs every test; OR needs just one.
Practice
1. In G4, show Promote if the product is Earbuds OR the revenue is over 100, otherwise Skip.
=IF(OR(D4="Earbuds",F4>100),"Promote","Skip")2. In G3, show Edge if the order was placed on Mon OR Fri, otherwise Mid.
=IF(OR(B3="Mon",B3="Fri"),"Edge","Mid")3. In G9, show Promote if the product is Earbuds OR the revenue is over 100. Otherwise show Skip.
=IF(OR(D9="Earbuds",F9>100),"Promote","Skip")4. In G8, show Phone if the product is Phone case OR Charger. Otherwise show Audio.
=IF(OR(D8="Phone case",D8="Charger"),"Phone","Audio")5. In G5, show Check if the order is from Abuja OR the quantity is 3 or more. Otherwise show OK.
=IF(OR(C5="Abuja",E5>=3),"Check","OK")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 →