IFERROR with VLOOKUP explained

IFERROR evaluates VLOOKUP first and uses its fallback only when that lookup fails. Here P-999 is missing, so #N/A is caught and replaced with Not found.

How Excel works this out

Inner to outer

Search for a value in the first column of a table and retrieve data from another column in the same row.

Check a formula for errors. Return a fallback value when one occurs, or the formula result when it does not.

Formula sample data

How this IFERROR formula works

The inner VLOOKUP returns #N/A. IFERROR marks that error as caught, selects the fallback, and returns Not found instead.

The rows above are ordered from the innermost calculation to the final result. Excel has to finish an inner function before the function around it can use that value. Edit a cell in the grid to see that dependency chain update for real.

Try your own formula and data

The sample spreadsheet is fully editable. Change the formula or any cell it references. The intermediate values recalculate in your browser.

Practice with an exercise

Here is an exercise that uses IFERROR. Type the formula into a real spreadsheet and we will check your answer as you go.

Nested IFERROR for multi-table fallback

Intermediate

Search across three inventory lists and return "Not found" only when a code is missing everywhere.

Open exercise

Common mistakes with IFERROR

If this formula is not doing what you expect, one of these is usually why.

Why does IFERROR always show Not found?

The wrapped lookup is failing every time. Test VLOOKUP on its own to expose the original error, then check the lookup value, range, and column number.

Does IFERROR only catch #N/A?

No. IFERROR catches any Excel error, including #REF!, #VALUE!, and #DIV/0!. Use IFNA when only a missing lookup should trigger the fallback.

Can IFERROR hide a broken formula?

Yes. A bad range or invalid column number can look like an ordinary Not found result. Debug the inner formula before wrapping it.

How can I test the success path?

Change A2 to an ID present in D2:D7, such as P-104. VLOOKUP will return 32 and IFERROR will pass it through without using the fallback.