AND, OR and NOT
Combine several conditions into one test, on their own or inside IF. Intermediate · 5 min · AND, OR, NOT, IF + AND/OR
Real decisions often depend on more than one thing. These three functions combine TRUE/FALSE tests:
AND(test1, test2, …)is TRUE only if every test is TRUEOR(test1, test2, …)is TRUE if at least one test is TRUENOT(test)flips TRUE to FALSE and FALSE to TRUE
On their own they return TRUE or FALSE. Put them in IF's test to turn several conditions into one decision.
Steps
Under-18s and over-65s swim at a concession rate. In
E2:E9, use OR to test whether the age is under 18 or 65 or over.A loyalty reward goes to swimmers who are members and have visited at least 12 times this month. Use AND in
F2:F9.Concession tickets cost $4.50 and standard tickets $7. In
G2:G9, put your OR test straight inside an IF to show each swimmer's price.Non-members who have visited 4 or more times should get a membership offer. In
H2:H9, showSend offerfor them and nothing ("") for everyone else. Use NOT to flip the member test:NOT(C2="Yes").
Remember
AND: every test must be TRUE.OR: at least one test must be TRUE.NOT: flips a result.- Put them in IF's test to make decisions that depend on several conditions.
Previous: Nested IF and IFS · Next: IFERROR and IFNA