The IFERROR command in Excel is a logical function designed to catch errors in formulas and replace them with a value of your choice, preventing the dreaded red error messages from cluttering your spreadsheets. To use it, you enclose the formula you want to test inside the IFERROR function, providing two arguments: the first is the formula to evaluate, and the second is the value or text to display if the formula results in any error. This guide covers how to implement this function, understand the specific errors it catches, and manage common scenarios where it is most useful.

What You'll Need

  • A computer with Microsoft Excel installed (Excel 2007 or later versions are required, as this function was introduced in 2007).
  • A spreadsheet containing at least one formula that has the potential to return an error, such as a division by zero, a text value in a mathematical function, or a reference to an empty cell.
  • A basic understanding of how to enter formulas into Excel cells, including the use of the equals sign (=) and the standard arithmetic operators.

Step-by-Step

  1. Locate the cell containing the error. Open your Excel workbook and navigate to the specific cell that is displaying an error message (e.g., #DIV/0!, #N/A, #VALUE!, #REF!, #NUM!, #NAME?, or #NULL!). This is the cell where the problematic formula resides.
  2. Click on the cell to select it. Single-click on the cell containing the formula. The formula bar at the top of the window will display the formula currently entered in the cell.
  3. Press F2 or click in the formula bar. This action puts Excel into edit mode for that cell. You can now see the exact formula text, which is essential for understanding how to wrap it correctly.
  4. Identify the exact formula to wrap. Look at the formula in the cell or formula bar. You need to identify the specific calculation or function that is generating the error. For example, if the cell contains =A1/B1 and returns #DIV/0!, that is the formula you will wrap.
  5. Construct the IFERROR function. Type the following structure into the cell or formula bar: =IFERROR(formula_to_test, value_if_error). Replace formula_to_test with the actual formula you identified in the previous step. Replace value_if_error with the text, number, or another formula you want to appear instead of the error.
  6. Example: Handling Division by Zero. Suppose your current formula is =A1/B1 and it returns #DIV/0!. To replace that with the text "No Value", you would type: =IFERROR(A1/B1, "No Value"). This tells Excel to try the division first; if it fails, display "No Value".
  7. Example: Handling VLOOKUP Not Found. If you are using =VLOOKUP("Apple", A:B, 2, FALSE) and it returns #N/A because "Apple" is not in your table, you can wrap it to say "Not Found": =IFERROR(VLOOKUP("Apple", A:B, 2, FALSE), "Not Found").
  8. Press Enter. After typing the complete IFERROR function, press the Enter key on your keyboard. Excel will evaluate the formula. If the underlying formula works, the result will be displayed normally. If it produces an error, your specified value_if_error will appear in the cell.
  9. Copy the formula to other cells (optional). If you have a column of similar formulas that might produce errors, click and drag the fill handle (the small square at the bottom-right corner of the selected cell) down to apply the corrected formula to the rest of the column.

Common Mistakes

One of the most frequent errors when using IFERROR is wrapping it around too much of the formula. The function only evaluates the result of the calculation. It cannot fix syntax errors in the formula itself. For example, if you type =IFERROR(A1+/, 0), Excel will still return a #NAME? error because the syntax inside the parentheses is incorrect. The IFERROR function will not catch this. The formula inside the first set of parentheses must be a valid, error-free Excel formula before IFERROR even gets a chance to run.

Another common issue arises from not being specific enough with the value_if_error argument. Simply using 0 for a division formula can be ambiguous. Does a zero mean the division was successful, or does it mean there was no data? It is often better to use text, such as 0 or "N/A", to make the cell contents meaningful to the human reader.

Tips

When deciding what to put in the value_if_error argument, consider the context of your data. If you are building a financial model, a common approach is to use a blank cell (simply typing two quotation marks, "") to hide the error without adding any extra text. This keeps the row height consistent and the data table looking clean. If the error represents a missing value, adding a clear text like "Data Missing" or "Not Available" is usually the best practice for data analysis and reporting.

Be cautious when applying IFERROR to entire columns. If you have a calculation at the bottom of a column that sums up a range of cells, and you use IFERROR to hide errors in the individual cells above, the sum at the bottom will appear correct even though it is mathematically invalid. Always ensure that IFERROR is used to handle specific, expected data issues, not to mask underlying data integrity problems that could lead to incorrect financial conclusions.

Troubleshooting

If your IFERROR formula is not working as expected, the first step is to verify the syntax of the formula inside the first set of parentheses. Ensure you have not made a typo in the function name, cell references, or operators. If the inner formula is syntactically correct but still returns an error, check that the cell references point to the correct data. If the inner formula returns a valid number but you are still seeing the error message, ensure you are not accidentally typing the function name in all caps (e.g., IFERROR is correct, IFERROR is not).

If you want to handle specific types of errors differently, the IFERROR function is not the right tool. IFERROR catches all errors. If you want to replace a #DIV/0! error with one text and a #N/A error with another, you must use a combination of the IF and ISERROR functions, or the more modern IFNA function for the #N/A error specifically. For example, =IF(ISERROR(A1/B1), "Error", A1/B1) is an older, verbose way to achieve the same result as IFERROR, but it allows for different responses based on the error type.

Frequently Asked Questions

Does IFERROR work in Google Sheets?

Yes, the IFERROR function is also available in Google Sheets and works with the exact same syntax and arguments as in Microsoft Excel.

What is the difference between IFERROR and IFNA?

IFERROR catches any error type, while IFNA only catches the #N/A error. IFNA is often preferred for VLOOKUP functions because it allows you to handle the specific case where a value is not found without masking other potential errors in the same formula.

How do I use IFERROR with the VLOOKUP function?

You simply place the VLOOKUP function inside the first set of parentheses of IFERROR. For example, =IFERROR(VLOOKUP(A1, B:C, 2, FALSE), "Not Found").

Can I nest multiple IFERROR functions?

Yes, you can nest them to handle different error types, though this makes the formula very long and complex. A better approach is usually to use the IF and ISERROR functions or separate the logic into different cells.

Will IFERROR slow down my spreadsheet?

For most standard workbooks, the performance difference is negligible. However, in extremely large datasets with millions of rows, wrapping every single formula in IFERROR can add a slight computational overhead.