How to Use IFERROR in Excel (Catch Formula Errors + Free Generator)

Returns a value you specify if a formula evaluates to an error; otherwise returns the result of the formula.

Generated Formula
=IFERROR(value, "")

Learning Resources

Want to master Excel? Check out this Top-Rated Course.

How to Use IFERROR in Excel and Google Sheets

IFERROR is one of the most important functions for creating robust spreadsheets. It catches errors like #DIV/0!, #N/A, #VALUE!, and #REF! and replaces them with a clean value — keeping your reports professional and your calculations running smoothly.

IFERROR Syntax

The syntax is simple: =IFERROR(value, value_if_error)

  • value: The formula, cell reference, or expression you want to evaluate.
  • value_if_error: What to return if the first argument produces any error.

Step-by-Step: Protect a Division Formula

Imagine you have a sales commission table:

A (Salesperson)B (Sales Amount)C (Commission Rate)D (Commission)
Alice10,0005%500
Bob05%0
Charlie8,000blank#DIV/0!

Without IFERROR, Bob and Charlie's rows show ugly errors. Here's how to fix it:

  1. Write your original formula: =B2*C2 — this calculates commission by multiplying the sales amount by the rate.
  2. Wrap with IFERROR: =IFERROR(B2*C2, 0) — if the multiplication fails (e.g., C2 is blank), show 0 instead of #DIV/0!.
  3. Copy down the column: Drag the formula to all rows. Every row now shows either a valid commission or 0 — no errors visible.

The result: clean, professional-looking data with no explanation needed.

IFERROR with VLOOKUP and XLOOKUP

One of the most common uses of IFERROR is to handle lookup failures gracefully:

  • VLOOKUP + IFERROR: =IFERROR(VLOOKUP(A2, B:C, 2, FALSE), "Not Found") — shows "Not Found" instead of #N/A when an employee ID has no match.
  • XLOOKUP alternative: XLOOKUP has a built-in if_not_found argument: =XLOOKUP(A2, B:B, C:C, "Not Found"). This is cleaner than wrapping in IFERROR.
  • INDEX MATCH + IFERROR: =IFERROR(INDEX(C:C, MATCH(A2, B:B, 0)), "Missing") — same protection for the INDEX MATCH combination.

IFERROR vs IFNA — When to Use Which

FunctionCatchesBest For
IFERRORAll errors (#N/A, #DIV/0!, #VALUE!, #REF!, #NAME?, #NUM!, #NULL!)Final polish of production reports
IFNAOnly #N/ALookup formulas where other errors should still surface

Common Pitfalls and Edge Cases

  • Masking bugs: IFERROR hides ALL errors. If your VLOOKUP is returning #REF! because a column was deleted, IFERROR silently covers it up. Always debug the inner formula first before wrapping with IFERROR.
  • Blank fallback: Use "" (empty string) to leave the cell blank on error: =IFERROR(A1/B1, ""). This looks clean in reports but remember the cell is not truly empty — it contains a formula returning "".
  • Nested IFERROR: You can nest IFERROR calls to try multiple strategies: =IFERROR(VLOOKUP(A2, Sheet1!A:B, 2, 0), IFERROR(VLOOKUP(A2, Sheet2!A:B, 2, 0), "Not in any sheet")) — tries Sheet1 first, then Sheet2, then gives up.
  • Performance: IFERROR evaluates the first argument completely. If the inner formula is slow (e.g., an array lookup over 100k rows), IFERROR doesn't speed it up — it just cleans the result.

Pro Tip: Use IFERROR as a final polish — never as a development crutch. Build and debug your inner formula first without IFERROR, then wrap it only after it works correctly. This way you catch real bugs during development instead of hiding them. For lookups that might fail, consider XLOOKUP's built-in if_not_found parameter — it's more explicit and doesn't mask other error types.

Common Errors & Fixes

  • IFERROR hides errors I want to see

    Causes:
    • Using IFERROR around a formula that can return #VALUE! or #REF! you need to fix.
    • Nested formulas: inner error is caught so outer logic never runs.
    Fixes:
    • Use IFNA instead to catch only #N/A, or fix the inner formula first.
    • Test the inner formula without IFERROR to debug, then wrap once correct.

Frequently Asked Questions

What errors does IFERROR catch?

IFERROR catches #N/A, #VALUE!, #REF!, #DIV/0!, #NAME?, #NUM!, and #NULL!. It returns your fallback value for any of these errors.

Should I use IFERROR around VLOOKUP?

Yes. When the lookup value is not found, VLOOKUP returns #N/A. Wrapping in IFERROR lets you show "Not Found" or 0 instead: =IFERROR(VLOOKUP(A2, B:C, 2, FALSE), "Not Found").

What is the difference between IFERROR and IFNA?

IFERROR catches all errors; IFNA catches only #N/A. Use IFNA when you want other errors (e.g. #VALUE!) to still show so you can debug them.

Can IFERROR hide formula errors in Google Sheets?

Yes. IFERROR works the same in Excel and Google Sheets. Use it to avoid #DIV/0! from division or #N/A from lookups.

Why is my IFERROR returning the fallback when the result looks correct?

The first argument might be returning an error you do not see (e.g. in a hidden column or due to a nested formula). Check the inner formula alone in a cell to see its real result.

Can I use IFERROR with INDEX MATCH?

Yes. Wrap the entire INDEX MATCH: =IFERROR(INDEX(C:C, MATCH(A2, B:B, 0)), "Missing"). If MATCH fails to find the lookup value, IFERROR returns "Missing" instead of #N/A.

Does IFERROR work with array formulas?

Yes, IFERROR wraps array formulas the same way. In older Excel, press Ctrl+Shift+Enter for array formulas inside IFERROR. In Excel 365 and Google Sheets, dynamic arrays work natively.

How do I use IFERROR to handle blank cells in calculations?

If your formula references blank cells that cause errors, IFERROR catches them: =IFERROR(A1/B1, 0). For more targeted handling, check with ISBLANK first: =IF(ISBLANK(B1), 0, A1/B1). This way, you distinguish between intentional blanks and actual errors.

Related Formulas

Explore related formula generators to solve similar problems

Want to become an Excel Pro?

Stop searching for formulas. Master Excel in 30 days with this top-rated course.

Learn More