Google Sheets IFERROR Function: Syntax, Examples & Tips

The IFERROR function returns a specified value if a formula results in an error, otherwise it returns the formula's result.
Google Sheets
IFERROR(value, [value_if_error])

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

On this page
  1. Parameters
  2. What is the IFERROR Function?
  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 or expression that you want to check for an error. This can be a cell reference, a formula, or a direct value.

value_if_error:
The value to return if the value results in an error. This can be a specific value, a formula, or a cell reference that defines what should be returned in case of an error.

What is the IFERROR Function?

The IFERROR function in Google Sheets is a useful tool that helps manage errors in formulas. It allows you to catch and handle errors gracefully, providing a way to display a custom message or an alternative result when an error occurs. This function is particularly helpful in ensuring that your spreadsheets remain clean and user-friendly, even when there are issues with the data or calculations.

In simpler terms, IFERROR helps you avoid displaying error messages like #DIV/0!, #N/A, or #VALUE! in your sheets, allowing you to present a more polished output.

A Practical Example

Imagine you are calculating the average sales per product in a sales report stored in a Google Sheets document:

Sales Data Table:

ProductIDTotalSalesNumberOfSales
10150010
1023000
10345015

You want to calculate the average sales per product. However, if the NumberOfSales is zero, it will result in a division error.

IFERROR Formula

To achieve this, you would use the IFERROR function as follows:

Google Sheets
=IFERROR(B2/C2, "No Sales")

In this formula:

  • B2 is the cell containing the TotalSales.
  • C2 is the cell containing the NumberOfSales.
  • "No Sales" is the value that will be returned if there is an error (like division by zero).

Result of the Formula

When you apply the IFERROR formula to the Sales Data Table, the output would look like this:

ProductIDTotalSalesNumberOfSalesAverageSales
1015001050.00
1023000No Sales
1034501530.00

In this case, for ProductID 102, the IFERROR function prevents a division error and instead displays "No Sales".

Why Use IFERROR?

IFERROR is beneficial because it simplifies error handling in your spreadsheets. It allows you to provide clear, user-friendly messages instead of confusing error codes. This enhances the readability of your data and makes it easier for others to understand your calculations.

Key Takeaways:

  • IFERROR: A function that catches errors in formulas and allows you to return a custom message or alternative result.
  • Error Management: Helps maintain a clean and professional appearance in your spreadsheets by avoiding error messages.
  • Common Use Cases: Ideal for financial calculations, data analysis, and any scenario where errors may occur in formulas.

IFERROR is an essential function for anyone working with data in Google Sheets, providing a powerful way to enhance data presentation and usability.

Happy spreadsheeting!

Example use case

You have a sales report where Column A lists product IDs and Column B shows sales figures. By using the IFERROR formula, you can display "Not Found" for any product ID that doesn't exist, ensuring clarity in your report without showing error messages.

Need more help with Google Sheets formulas?

Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.

Explore all Google Sheets formulas

Browse our complete library of Google Sheets 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.