Excel IFERROR Function: Syntax, Examples & Tips

The IFERROR function is used to return a specified value if a formula results in an error, ensuring cleaner and more user-friendly spreadsheets.
Excel
=IFERROR(value, value_if_error)

One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.

Need more than a single IFERROR formula? Try our free AI for Excel — it reads your entire spreadsheet, answers questions in plain English, and builds charts and analysis in the same chat.

On this page
  1. Parameters
  2. What is an IFERROR Formula in Excel?
  3. A Practical Example
  4. IFERROR Formula
  5. Result of the Formula
  6. Why Use IFERROR?
  7. Key Takeaways:
  8. Example use case

Parameters

value:
The value, expression, or formula that you want to evaluate for an error.

value_if_error:
The value or expression to return if the evaluated value results in an error.

What is an IFERROR Formula in Excel?

The IFERROR function in Excel is a handy tool that allows you to manage and handle errors in your formulas. It evaluates a formula or expression and returns a specified value if an error is detected; otherwise, it returns the result of the formula. This function is particularly useful for preventing error messages from appearing in your spreadsheets, making your data cleaner and more user-friendly.

In simpler terms, the IFERROR function helps you deal with potential errors in your calculations, allowing you to provide alternative outputs or messages when things don't go as planned.

A Practical Example

Imagine you are working on a financial report and have the following data in an Excel spreadsheet:

Financial Data Table:

ItemCostQuantity
Widget A105
Widget B03
Widget C152
Widget D200
Widget E254

You want to calculate the total revenue for each item by multiplying the cost by the quantity. However, you want to avoid displaying errors if the quantity is zero.

IFERROR Formula

To calculate the total revenue while handling potential errors, you would use the IFERROR formula as follows:

Excel
 =IFERROR(B2*C2, "No Revenue")

Breakdown of the Formula:

  • B2*C2: This is the formula that calculates the total revenue (Cost * Quantity).
  • "No Revenue": This is the value that will be returned if the formula results in an error (e.g., if Quantity is zero).

Result of the Formula

When you apply the formula to each row, it will calculate the total revenue for each item. If the quantity is zero, it will display "No Revenue" instead of an error. The output would be:

ItemTotal Revenue
Widget A50
Widget BNo Revenue
Widget C30
Widget DNo Revenue
Widget E100

Here, the total revenue is calculated as follows:

  • Widget A: 10 * 5 = 50
  • Widget B: 0 * 3 = No Revenue
  • Widget C: 15 * 2 = 30
  • Widget D: 20 * 0 = No Revenue
  • Widget E: 25 * 4 = 100

Why Use IFERROR?

The IFERROR function is particularly useful when you want to maintain a clean and professional appearance in your spreadsheets. It allows you to handle errors gracefully, providing alternative messages or values instead of displaying error codes like #DIV/0! or #VALUE!. This enhances the readability of your data and improves user experience.

Key Takeaways:

  • IFERROR: Handles errors in formulas and provides alternative outputs.
  • Improved Data Presentation: Keeps your spreadsheets clean and user-friendly by avoiding error messages.
  • Common Use Cases: Ideal for financial calculations, data analysis, and any scenario where errors may occur in formulas.

Understanding how to use the IFERROR function can significantly enhance your Excel skills, allowing you to create more robust and error-resistant spreadsheets.

Happy calculating!

Example use case

You have a table where Column A contains product names and Column B contains their corresponding prices. In Column C, you want to calculate the total cost for a specific quantity of each product listed in Column D. You can use the IFERROR function to handle any potential errors that arise from calculations, such as dividing by zero or referencing a non-existent product. This ensures that your total cost calculations remain accurate and user-friendly, allowing for seamless financial analysis without interruptions from error messages.

Beyond the IFERROR function: Better Analyst is a full Excel AI that goes well past individual formulas. Upload any spreadsheet and ask questions in plain English — you'll get formulas, data analysis, and charts back in seconds. It's a free AI Excel assistant that works with any .xlsx, .xls, or .csv file — no plugins, no Microsoft 365 required.

Don't have a spreadsheet yet? Use our free AI spreadsheet generator to turn a text prompt into a downloadable Excel file — a full AI Excel sheet maker that builds headers, columns, and formulas from your description.

Need more help with Excel formulas?

Create a free account for formula help, explanations, and spreadsheet analysis. Usage limits depend on your plan.

Explore all Excel formulas

Browse our complete library of Excel formula guides

Compare your options

Decide with evidence, not a sales pitch.

Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.

  1. 01ChatGPTOpen a balanced comparison prompt in ChatGPT.
  2. 02ClaudeOpen the same research prompt in Claude.
  3. 03PerplexityResearch the comparison with linked web sources.

AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.