Free IFERROR practice

IFERROR practice exercises

IFERROR returns a value of your choice instead of an error, such as #N/A from a lookup that finds nothing. 5 reps, from easy to hard, each checked in a real spreadsheet engine. 2 free, 3 with Pro.

=IFERROR(value, value_if_error)
Skill: IFERROR Change skill (45)

IFERROR guide

How to use IFERROR in Excel

IFERROR returns a value of your choice instead of an error. It's most often wrapped around a lookup, so a missing code shows 0 or "Not found" instead of #N/A, or around a division that might divide by zero.

If the formula works, IFERROR passes its result through untouched. Use it on purpose: it hides every kind of error, including mistakes in your own formula.

Syntax

=IFERROR(value, value_if_error)
ArgumentWhat it is
valueThe formula to try, such as a VLOOKUP.
value_if_errorWhat to show if that formula returns any error: 0, "" for an empty-looking cell, or a message in quotes.

Examples

Example 1 A lookup that finds nothing. P-999 isn't in the table, so instead of #N/A the cell shows 0.
F2fx=IFERROR(VLOOKUP(E2,A2:C5,3,FALSE),0)
ABCDEF
1CodeProductPriceCodePrice
2P-101Desk249P-9990
3P-102Chair129
4P-103Lamp39
5P-104Shelf89

=IFERROR(VLOOKUP(E2,A2:C5,3,FALSE),0) returns 0.

Example 2 A lookup that works. When the code exists, IFERROR returns the lookup's result unchanged.
F2fx=IFERROR(VLOOKUP(E2,A2:C5,3,FALSE),0)
ABCDEF
1CodeProductPriceCodePrice
2P-101Desk249P-102129
3P-102Chair129
4P-103Lamp39
5P-104Shelf89

=IFERROR(VLOOKUP(E2,A2:C5,3,FALSE),0) returns 129.

Example 3 Dividing by zero. Ben has no orders yet, so sales divided by orders would be #DIV/0!.
D3fx=IFERROR(B3/C3,"No orders")
ABCD
1RepSalesOrdersPer order
2Ana52008
3Ben00No orders

=IFERROR(B3/C3,"No orders") returns No orders.

Common mistakes

Hiding a mistake in your own formula

The table has 3 columns, so column 4 is a #REF! error. IFERROR turns it into 0, so the mistake looks like a missing price. Get the formula right before wrapping it.

Wrong=IFERROR(VLOOKUP("P-103",A2:C5,4,FALSE),0) → 0

Right=IFERROR(VLOOKUP("P-103",A2:C5,3,FALSE),0) → 39

Wrapping the wrong part

IFERROR must wrap the formula that fails. Wrapping only the lookup value does nothing; the VLOOKUP around it still returns #N/A.

Wrong=VLOOKUP(IFERROR("P-999",0),A2:C5,3,FALSE) → #N/A

Right=IFERROR(VLOOKUP("P-999",A2:C5,3,FALSE),0) → 0

IFERROR questions

What is the difference between IFERROR and IFNA?

IFNA only catches #N/A, the error a lookup returns when it finds nothing. IFERROR catches every error. IFNA is safer around lookups because real mistakes such as #REF! still show.

How do I show a blank instead of an error?

Use two double quotes: =IFERROR(VLOOKUP(E2,A2:C5,3,FALSE),"").

Should I use IFERROR with XLOOKUP?

Usually not. XLOOKUP has its own fourth argument for a missing value: =XLOOKUP(E2,A2:A5,C2:C5,0).

Related functions

Reading is the warm-up

The reps are what make it stick. Try IFERROR in the practice sheet above.

Practise IFERROR ↑