Learning Excel: AND and OR
AND, OR and NOT
On the Lessons sheet, Dave keeps track of the badges. "You can only go in the deep end with badge A and B. For the gala, B is enough, or twenty lengths." Two conditions at once: time for AND and OR.
AND
AND takes a few tests and gives TRUE if they're all true. If one of them is FALSE, the whole answer is FALSE.
F2 holds =AND(C2,D2). Ella has badge A, but not B, so Ella can't go in the deep end yet.
=AND(C2,D2)
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Child | Age | Badge A | Badge B | Lengths | Deep end |
| 2 | Ella | 7 | TRUE | FALSE | 12 | FALSE |
| 3 | Ilias | 9 | TRUE | TRUE | 20 | |
| 4 | Zoë | 6 | FALSE | FALSE | 4 | |
| 5 | Ben | 10 | TRUE | TRUE | 26 | |
| 6 | Amira | 8 | TRUE | FALSE | 15 | |
| 7 | Theo | 11 | TRUE | TRUE | 18 | |
| 8 | Nina | 9 | FALSE | FALSE | 8 | |
| 9 | Sonny | 12 | TRUE | TRUE | 30 | |
| 10 |
OR and NOT
OR gives TRUE if at least one test is true. =OR(E2>=20,D2) says: twenty lengths or badge B, one of the two is enough.
NOT flips a logical value: =NOT(C2) is TRUE for anyone who does not have badge A yet.
Try it yourself
Which children are allowed in the deep end? In F2, put TRUE if the child has both badges, and fill down to F9.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Child | Age | Badge A | Badge B | Lengths | Deep end | |
| 2 | Ella | 7 | TRUE | FALSE | 12 | ||
| 3 | Ilias | 9 | TRUE | TRUE | 20 | ||
| 4 | Zoë | 6 | FALSE | FALSE | 4 | ||
| 5 | Ben | 10 | TRUE | TRUE | 26 | ||
| 6 | Amira | 8 | TRUE | FALSE | 15 | ||
| 7 | Theo | 11 | TRUE | TRUE | 18 | ||
| 8 | Nina | 9 | FALSE | FALSE | 8 | ||
| 9 | Sonny | 12 | TRUE | TRUE | 30 | ||
| 10 |
Ready for more?
The full lesson has 5 exercises, from easy to challenging, with hints, points and a streak you can build.
Start the lesson