How to Add IFERROR in Excel to Handle Formula Errors

Formulas & functions · Updated November 3, 2026

How to Add IFERROR in Excel to Handle Formula Errors

To add IFERROR in Excel, wrap your existing formula inside IFERROR and specify what to show if that formula returns an error. For example, with a numerator in A2 and a denominator in B2, enter =IFERROR(A2/B2,0) to show 0 instead of an error when the division fails. You need a workbook with a formula or calculation you want to handle; IFERROR is available in Microsoft 365 for Windows, Mac, and Excel for the web.

What You’ll Need

  • An Excel workbook containing a formula that may return an error, or cells where you plan to enter a formula.
  • A decision about what should appear when an error occurs, such as a blank cell, a message, or a value like 0. Choose a fallback that makes sense for your calculation.
  • Microsoft Excel for Microsoft 365, Excel for the web, or another Excel version that supports IFERROR. The steps below use Excel for Microsoft 365 on Windows.

Step-by-Step

  1. Find the formula to protect. Click the cell and inspect the formula bar. Identify the complete formula that could return an error. Common examples include dividing by a cell that might be zero, looking up a value that may not exist, or using a reference to a cell that could be deleted. If the cell currently displays an error, the formula bar can still show the expression that produced it. Do not start by deleting the formula; you will need its expression to place inside IFERROR.
  2. Choose the fallback result. Decide what a reader should see when the calculation cannot return a normal result. Use 0 only when zero is a meaningful and non-misleading substitute. A blank can make a report look cleaner, while a message such as “Not found” can explain a failed lookup. In some calculations, displaying an error is safer because it signals that the result needs investigation. IFERROR does not fix the underlying cause; it changes what the cell displays when the formula produces an error.
  3. Wrap the existing formula in IFERROR. The function takes two arguments: the calculation to evaluate, followed by the result to return if that calculation gives an error. Keep the original formula intact as the first argument, then add a comma and your chosen fallback as the second argument. For example, with a product quantity in A2 and a unit price in B2, a formula multiplying them can be wrapped as =IFERROR(A2*B2,0). Because multiplication of ordinary numeric values usually does not produce an error, this example is useful only if the referenced cells or calculation could in fact produce one; use IFERROR where an error is plausible, not automatically on every formula.
  4. Enter and check the formula. Select the target cell, type the complete formula beginning with an equals sign, and press Enter. Check the displayed result and then select the cell again to verify in the formula bar that both the original expression and fallback are present. If you are using the division example from the opening paragraph, with a numerator in A2 and a denominator in B2, =IFERROR(A2/B2,0) returns 5 when A2 is 10 and B2 is 2; if B2 is 0, it returns 0 instead of #DIV/0!.
  5. Use a blank or explanatory text when appropriate. For a division result that should appear empty when the calculation errors, with a value in A2 and a divisor in B2, enter =IFERROR(A2/B2,""). The two quotation marks create an empty text value, so the cell looks blank; it is not the same as a truly empty cell. For a lookup that should explain a missing match, with the search value in E2, search keys in A2:A20, and return values in B2:B20, enter =IFERROR(VLOOKUP(E2,A2:B20,2,FALSE),"Not found"). This exact-match lookup returns the corresponding value from column B or displays “Not found” if the lookup produces an error.
  6. Copy the formula to other rows if needed. If the formula is part of a list, select the completed cell and drag its fill handle (the small square at the lower-right corner) down the relevant rows, or copy and paste it. Check a few copied formulas to make sure references shift as intended: A2 and B2 normally become A3 and B3 in the next row. Add dollar signs to references only when you need to keep a row or column fixed. For example, a reference to a fixed lookup table may need absolute references before you fill the formula down.
  7. Test both normal and error cases. Check at least one row where the original formula should calculate normally and one row where it is expected to fail. Confirm that normal values remain correct and that the fallback appears only when needed. If using a message or blank, check that other parts of the workbook, such as totals, charts, and later formulas, handle that output sensibly. Save the workbook after verifying the results.

Common Mistakes

  • Using the wrong number of arguments. IFERROR needs a value to evaluate and a fallback value. A missing comma, closing parenthesis, or second argument can produce a formula error. Check that the expression has the structure =IFERROR(formula, fallback) and that the parentheses are balanced.
  • Hiding errors that need attention. A fallback of 0 can make a failed calculation look like a real zero. That can distort totals or lead someone to believe a value was measured. For financial, inventory, or operational reports, decide whether a clear label or a visible error is more honest than 0.
  • Putting the original formula outside IFERROR. The full expression that can fail must be the first argument. For example, in the division example, =IFERROR(A2/B2,0) handles an error from the division; typing =IFERROR(A2)/B2 is not the same formula and is missing the required fallback argument.
  • Using IFERROR to conceal a bad reference. If a formula points to the wrong range or a deleted cell, IFERROR may hide the resulting problem. Fix a mistaken reference rather than simply making its error invisible. If you intentionally want a fallback for a missing lookup result, make that behavior clear in the workbook.
  • Expecting IFERROR to replace a blank or zero. A formula that returns 0 is not an error, and an empty input cell is not automatically an error. IFERROR returns the original result in both cases unless the calculation itself generates an error. If you want a different output for blanks or zero values, you need to test for those conditions separately.

Tips

  • Use a fallback that communicates meaning. A blank can be appropriate for a presentation-only result, while “Not found” can be more useful in a lookup column. A numeric fallback is easier to include in arithmetic, but can be misleading if it is mistaken for a real measurement.
  • Keep a copy of the original formula while building or reviewing a more complex expression. This makes it easier to distinguish a calculation problem from an error-handling problem.
  • Use IFERROR around the smallest sensible calculation. Wrapping an entire long formula can mask errors from several different parts, making the cause harder to trace. A targeted wrapper can make it clearer which operation is allowed to use a fallback.
  • Remember that IFERROR handles many Excel error values, including #DIV/0!, #N/A, #VALUE!, #REF!, #NAME?, and #NUM!. That broad coverage is convenient, but it also means the same fallback can hide errors that have different causes.
  • On Excel for Mac, enter the same formula in a cell; the function and argument order are the same. Excel for the web also supports IFERROR and uses the same formula structure. In installations configured to use semicolons as argument separators, Excel may display or require semicolons instead of commas; follow the separator used by your Excel settings.
  • If you want to handle only a missing lookup result while leaving other errors visible, consider IFNA instead of IFERROR. IFNA is designed to catch #N/A specifically. That narrower behavior can make troubleshooting easier when other errors should not be hidden.

Troubleshooting

The formula shows a syntax error or Excel rejects it. Confirm that you began with =, typed IFERROR correctly, supplied both arguments, and closed every parenthesis. If your regional settings use semicolons, replace argument-separating commas with semicolons. Also check that text fallbacks have straight double quotation marks around them.

The original error still appears. Make sure the error-producing expression is actually inside the first argument. Look for an extra closing parenthesis that ends IFERROR too early, or for a formula that refers to a different cell than the one you tested. Then reproduce the problem in a simple test cell, using the same references, to confirm that the fallback works on the error you are seeing.

A blank appears when you expected a number. Review the second argument: "" deliberately displays a blank-looking result. Check whether the source formula is producing an error and whether a blank is the intended fallback. Remember that a blank-looking formula cell is still occupied by a formula, which can matter to functions that count cells or test whether a cell is empty.

The formula returns 0 but you expected the error to remain visible. Check whether the second argument is 0 and whether the original calculation is failing. If the error itself is useful for diagnosing the workbook, remove IFERROR temporarily or use a narrower handler such as IFNA for a lookup-only #N/A case. Restore the intended formula after finding the cause.

Copied rows show unexpected results. Select one of the copied cells and inspect its formula. Relative references normally change as the formula is filled down. If a lookup range has shifted, edit the formula to use fixed references for that range, then refill the cells. Test the first, middle, and last rows rather than assuming every copied formula points to the right data.

Frequently Asked Questions

What does IFERROR do in Excel?
It evaluates a value or formula and returns that result unless it produces an error. If there is an error, IFERROR returns the fallback you specified as its second argument.

What is the basic IFERROR formula?
The pattern is =IFERROR(value,value_if_error). Replace value with the formula you want Excel to evaluate and replace value_if_error with your chosen fallback.

Can IFERROR show a blank instead of an error?
Yes. Put "" as the second argument. The cell will look blank when the first argument returns an error, although the cell still contains a formula.

Does IFERROR catch every Excel error?
It catches Excel error values from the formula it evaluates, including common errors such as #DIV/0! and #N/A. It does not treat a normal zero result or an ordinary blank input as an error.

Should I use IFERROR or IFNA?
Use IFERROR when you want the same fallback for any error from the expression. Use IFNA when you only want to handle #N/A and want other error types to remain visible.

Does IFERROR work in Excel for Mac and Excel for the web?
Yes. The function syntax is the same in Microsoft 365 for Windows, Microsoft 365 for Mac, and Excel for the web. Depending on regional settings, your argument separator may be a comma or a semicolon.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.