TRUE, FALSE and logical tests: practice exercises
comparisons, NOT, AND, XOR. 5 exercises on real-looking data, each marked the moment you press Check. The first exercise is below to try now; the full lesson is part of Pro.
In D2, show TRUE if the person's sales reached their target (hitting it exactly counts) and FALSE if not. You don't need IF.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Employee | Target | Sales | Met target |
| 2 | Marek | 55 | 50 | |
| 3 | Tanya | 40 | 40 | |
| 4 | Femi | 60 | 60 | |
| 5 | Jess | 20 | 28 | |
| 6 | Zoe | 50 | 50 | |
| 7 | Ivan | 60 | 59 | |
| 8 | Sunil | 35 | 22 | |
| 9 | Nadia | 50 | 50 | |
| 10 | Chen | 55 | 67 | |
| 11 | Ollie | 45 | 45 |
How it works
A comparison such as =B2>=C2 gives TRUE or FALSE. You can show that answer on its own, without IF. TRUE and FALSE are values, not text, so they never go in quotes.
NOT turns TRUE into FALSE and back. AND is TRUE when every test is, OR when at least one is, and XOR when an odd number are: with two tests, exactly one.
=D2>=C2 =NOT(E2) =AND(B2>=10,C2="Yes") =XOR(C2>=B2,C4>=B4)
Tests give TRUE or FALSE
Every comparison is a question with a yes-or-no answer. Type =B2>=C2 and the cell shows TRUE or FALSE.
=equal to,<>not equal to>more than,>=at least<less than,<=at most
IF uses a test like this to choose what to show. When TRUE or FALSE is all you need, leave IF out.
Worked example
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Name | Sales | Target | Met? |
| 2 | Amira | 52 | 40 | |
| 3 | Ben | 30 | 35 | |
| 4 | Cara | 45 | 45 |
=B2>=C2in D2. Is Amira's sales figure at least her target? 52 is more than 40, so TRUE.=B2>=C2in D2. Copied down, each row asks its own question. Ben falls short, so FALSE. Cara hits 45 exactly, and >= counts that, so TRUE.
NOT, AND, OR and XOR
NOT(D2)flips the answer: TRUE becomes FALSE.AND(test1, test2)is TRUE only when every test is TRUE.OR(test1, test2)is TRUE when at least one test is TRUE.XOR(test1, test2)is TRUE when exactly one of two tests is TRUE, not both.
TRUE and FALSE are values, not words: "TRUE" in quotes is just text. XOR is in Excel 2013 and later, and in Google Sheets.
What you'll practise
- In D2, show TRUE if the person's sales reached their target (hitting it exactly counts) and FALSE if not. You don't need IF.
- This is a stock check. In D2, show TRUE if the number counted matches the number on the system, and FALSE if it doesn't.
- Column C shows TRUE for invoices that have been paid. In D2, use NOT to show TRUE for the invoices that still need chasing, and FALSE for the rest.
- People get a bonus if their sales are at least the target in H1 and their attendance is at least the target in H2. In D2, show TRUE or FALSE for each person.
- Each expenses claim needs approving by a manager and by finance. Claims that one has approved but the other hasn't need chasing. In D2, use XOR to show TRUE when exactly one of the two has approved.