MySheetAI
ProductWhat you can askPricing
Sign inAsk your data
MySheetAI
ProductWhat you can askPricingFormula generatorBlogChangelogFAQContactPrivacyTerms
© 2026 MySheetAI. All rights reserved.
Answers/How to Use IFERROR to Replace a Formula Error with a Clean Result

How do I stop a formula from showing an error like #N/A or #DIV/0?

IFERROR wraps another formula and returns a fallback value whenever that formula would show any error: =IFERROR(original_formula, fallback_value). If the original formula works normally, IFERROR just returns its normal result; it only steps in when there would otherwise be an error.

Formula (Excel and Google Sheets)

=IFERROR(VLOOKUP(A2,Sheet2!A:D,3,FALSE),"Not found")

IFERROR takes two arguments: the formula you actually want to run, and what to show instead if that formula errors out. In the example above, if VLOOKUP cannot find A2 in Sheet2 and would normally show #N/A, IFERROR shows the text "Not found" instead, so the sheet stays readable instead of filling up with error codes.

IFERROR catches every kind of error the wrapped formula can produce, not just #N/A: #DIV/0!, #VALUE!, #REF!, and the rest all get replaced the same way. That is useful for cleaning up a report, but it can also hide a real mistake, so use a specific fallback message rather than a blank cell, and only wrap the formula once you understand why it might error in the first place.

Step by step

  1. 1

    Write the formula you want first

    Build the VLOOKUP, division, or other formula on its own, so you know it works for the cases where it should succeed.

  2. 2

    Wrap it in IFERROR

    Put the whole formula inside IFERROR(...) as the first argument.

  3. 3

    Add a fallback as the second argument

    Choose a short, specific fallback like "Not found" or 0, in quotes if it is text, so it is clear a fallback was used rather than a real result.

Common questions

Does IFERROR fix the underlying problem causing the error?

No. It only changes what displays. If VLOOKUP cannot find a match, the data issue causing that (a typo, a missing row) still exists; IFERROR just keeps it from showing as a raw error code.

Can IFERROR hide a mistake I actually want to see?

Yes. Because it catches every error type, wrapping a formula in IFERROR too early can mask a genuine problem, like a broken reference, instead of just an expected miss. Use a descriptive fallback so you can tell the difference.

Related formulas

Related

How to Use VLOOKUP in Excel and Google Sheets

Related

How to Use INDEX and MATCH Together in Excel and Google Sheets

Related

How to Write a Nested IF Formula (and When to Avoid It)

From the blog

How to Make Sense of Your Spreadsheet Data Without Being an Analyst

Want a formula written for your exact spreadsheet, not a generic example?

Try the free formula generator