IFERROR in Excel: examples and practice

IFERROR gives back the result of a formula, or your own value if the formula gives an error. For example, =IFERROR(B3/C3,0) shows 0 instead of #DIV/0! when C3 is 0.

Syntax

=IFERROR(value, value_if_error)
=IFNA(value, value_if_na)
value
The formula to calculate, for example B3/C3 or a VLOOKUP.
value_if_error
The result when the formula gives any error. Use 0, "" or a short text.

Examples

Example data

ABC
1ItemSoldHours
2Cones1208
3Shakes450
4Cups605
FormulaResultWhat it does
=IFERROR(B2/C2,0)15No error, so IFERROR gives the normal result: 120 / 8.
=IFERROR(B3/C3,"No hours")No hoursC3 is 0. Division by 0 gives #DIV/0!, so IFERROR shows the text.
=IFERROR(VLOOKUP("Tea",A2:B4,2,FALSE),"Not found")Not foundTea is not in the list. VLOOKUP gives #N/A, and IFERROR shows a message.

Try it

In cell E3, divide B3 by C3. Show 0 when the result is an error.

Show the solution

=IFERROR(B3/C3,0) → 0

Common mistakes

IFERROR hides real problems

IFERROR catches every error, also a typo like #NAME?. Check the formula first, then add IFERROR. For lookups, IFNA catches only #N/A.

Text where a number is needed

If IFERROR gives "No hours", a SUM over that column skips it. Use 0 when you add the results later.

Priya Nair, runs Lantern Fest, a small music festival

Practice this in a story

A short lesson from a real job. We show you each step, then you do it yourself.

No #DIV/0! on the board · Module 5 · Logical · 4 min

Fans rate the bands on the info board. Some bands have no votes yet, and the board shows #DIV/0!. Some bands have no next show, and the board shows #N/A. The fans think the board is broken.

Practice this in a story

Related functions