Excel Guide

How to Use IFERROR in Excel: Replace #N/A and Other Errors With a Friendly Message

=IFERROR(value, value_if_error). IFERROR checks a formula: if the formula works, you get its normal result; if it errors, you get the fallback value you chose instead. It is the one-function fix for a lookup that returns #N/A, a division by an empty cell, and any other error you would rather show as a clean message. Practise it: IFERROR — 10 Excel practice problems.

The two arguments — both required

Microsoft's IFERROR reference gives the syntax as =IFERROR(value, value_if_error), and both arguments are required:

IFERROR catches all seven error types Excel produces: #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? and #NULL!. If the formula does not error, IFERROR simply passes its result through unchanged — it never alters a working answer.

The lookup case: turn #N/A into "Not Found"

This is where most people meet IFERROR. A VLOOKUP for a product that is not in the table returns #N/A, which looks broken to anyone reading the sheet. Wrapping the lookup gives you a message instead:

=IFERROR(VLOOKUP(A2, B1:C2, 2, FALSE), "Not Found")

Worked through on PractiseSkills' IFERROR topic page, with A2 = "Gizmo" and the table B1:C2 holding Widget 10 and Gadget 15, the lookup fails and the formula returns "Not Found". Change A2 to "Widget" and the same formula returns 10 — when the lookup succeeds, IFERROR passes the real value through unchanged. The same wrap works for XLOOKUP, as the topic page's fifth exercise shows: =IFERROR(XLOOKUP(...), "No Match").

Pick the right fallback for the job

The fallback is not decoration — downstream formulas read it, so choose one that keeps the sheet working:

The one mistake: hiding errors you actually need to see

IFERROR catches every error type, not just the one you were expecting. Wrap a whole chain of calculations in it and a #REF! from a deleted column, or a #NAME? from a mistyped function, disappears into your friendly fallback — and you will not know the formula is broken until the numbers downstream stop adding up. Two habits keep it safe:

  1. Wrap the smallest piece that can fail, usually just the lookup or the division, not the entire formula.
  2. Use a fallback that still signals a problem — "Not Found" rather than a blank — when the error might mean bad data rather than a routine miss.

If you only want to catch a failed lookup (#N/A) and still see every other error, that is what IFNA is for: same two-argument shape, but it reacts to #N/A only. IFERROR is the broader tool; IFNA is the precise one.

IFERROR or XLOOKUP's built-in fallback?

XLOOKUP has a fourth argument that supplies its own fallback when nothing matches, so a plain XLOOKUP lookup does not strictly need IFERROR. IFERROR still earns its place in three spots: wrapping VLOOKUP, which has no fallback argument; guarding a division or any other calculation that is not a lookup; and wrapping an XLOOKUP whose inputs might error for a reason other than a missing match. Learn the IFERROR wrap first — it works in every version of Excel from 2007 onward, including files where XLOOKUP does not exist.

Practise it

The IFERROR topic page has 10 exercises that build up step by step — handling a failed lookup gracefully, confirming a successful lookup passes through, providing a numeric default for a missing match, a fallback for a missing employee record, guarding an XLOOKUP the same way, a fallback price lookup with a zero default, combining IFERROR with a text message, guarding a grade-table lookup, confirming a matched order lookup, and a numeric default for a rate lookup. Three are free with worked solutions and no sign-up needed; the rest are graded on the formula you write in the live spreadsheet. If the lookup itself is not solid yet, start with the VLOOKUP exercises first, then come back and wrap them — and browse the full list of topics on the practice hub.

Try it yourself

Practice IFERROR with real interactive exercises and instant feedback.

Start practicing IFERROR →