Wishing all our customers a happy Halloween

Wishing all our customers a very happy Christmas

Wishing all our customers a happy New YearThe New Year in 10Happy New Year! Wishing all our customers a wonderful

Wishing all our customers a happy Easter

LEARN · SKILL 3 OF 11

IF, IFS, AND, OR and IFERROR

IF turns a rule, such as "flag orders over 500", into a formula. AND, OR and IFERROR build on it.

  1. LearnRead the guide and its worked examples.
  2. PractiseA drill on just this skill, easier tasks first. Stuck? “Show me how”.
  3. TestA timed mock in the style your employer named.
  4. ReviewYour report shows what cost marks and what to practise next.

The functions

IF =IF(test, value_if_true, value_if_false)
Checks a test. Shows the first value if it is true, the second if not.
IFS =IFS(test1, value1, test2, value2, ...)
Checks tests in order and shows the value for the first one that is true.
AND =AND(test1, test2, ...)
TRUE only if every test is true.
OR =OR(test1, test2, ...)
TRUE if at least one test is true.
IFERROR =IFERROR(formula, value_if_error)
Shows the formula's result, or your chosen value if the formula gives an error.

Worked examples

Example 1 Did each rep hit target?

D2
ABCD
1RepSalesTargetResult
2Amy5,2005,000Met
3Ben4,7005,000
D2 holds =IF(B2>=C2,"Met","Not met") and shows Met (highlighted).

Piece by piece

IF(
Check something and choose what to show.
B2>=C2
The test: are sales greater than or equal to the target? 5200 is, so it is TRUE.
"Met"
Shown when the test is TRUE. Text goes in double quotes.
"Not met"
Shown when the test is FALSE. Ben's row would show this.

Example 2 Bonus only if two rules are both met

D2
ABCD
1RepSalesDays offBonus?
2Cara6,1003No bonus
3Dev5,4001
D2 holds =IF(AND(B2>=5000,C2<=2),"Bonus","No bonus") and shows No bonus (highlighted).

Piece by piece

AND(
Both tests inside must be true.
B2>=5000
Sales of at least 5000. Cara's 6100 passes.
C2<=2
Two days off or fewer. Cara had 3, so this fails.
IF(AND(...), ...)
One test failed, so AND is FALSE and IF shows "No bonus". Dev's row would show "Bonus".

Example 3 Hide a divide-by-zero error

D2
ABCD
1ShopVisitorsSalesRate
2High St00n/a
3Market Sq25040
D2 holds =IFERROR(C2/B2,"n/a") and shows n/a (highlighted).

Piece by piece

C2/B2
Sales divided by visitors. With 0 visitors this is #DIV/0!.
IFERROR(...,
If the sum inside gives an error, show something else.
"n/a"
What to show instead of the error. On the next row the rate works out normally: 0.16.

Common mistakes

Excel and Google Sheets

In Excel: IFS needs Excel 2019 or Microsoft 365. In older versions, nest IFs: =IF(A2>=90,"A",IF(A2>=70,"B","C")).

In Google Sheets: IF, IFS, AND, OR and IFERROR work the same way. Google Sheets shows a tooltip with each argument as you type.

Now practise it

Reading gets you started; doing it under a clock is what the test checks. Practise this skill on its own, easier tasks first, then take a mock.

Practise in the Excel style Practise in the Google Sheets style

Skill drills come with the 30-day and 90-day passes. No pass yet? Try the free five-task mini-mock, no account needed.