Excel functions / Logical
AND, OR, NOT & XOR
Combine or reverse TRUE/FALSE tests.
Syntax
=AND(test1, test2, ...)
=OR(test1, test2, ...)
=NOT(test)
=XOR(test1, test2, ...)Arguments
test1, test2, ... | Comparisons that are TRUE or FALSE. |
|---|
How it works
AND is TRUE only when every test is TRUE. OR is TRUE when at least one is. NOT flips TRUE to FALSE and back. XOR is TRUE when exactly one of two tests is TRUE.
On their own they return TRUE or FALSE. Put them inside IF to turn that into a result: =IF(AND(B2>=50,C2="Yes"),"Credit","None").
Example
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Student | Score | Attended | ||
| 2 | Ana | 72 | Yes | TRUE | |
| 3 | Ben | 45 | Yes | ||
| 4 | Cal | 88 | No | ||
| 5 |
Result: TRUE. Ana passed and attended, so both tests are TRUE.
Tips
- NOT(C2="Yes") gives the same answer as C2<>"Yes". Use whichever reads more clearly.
Practise AND, OR, NOT & XOR
Try it yourself in a real spreadsheet, with instant feedback on every answer.