How to Use IFERROR in Excel: Simple Guide with Examples
Use the
IFERROR function in Excel to catch and handle errors in formulas by specifying a value to return if an error occurs. It helps keep your spreadsheet clean by replacing error messages with custom text or values.Syntax
The IFERROR function has two parts:
- value: The formula or expression to check for errors.
- value_if_error: The result to show if the first part causes an error.
It looks like this:
excel
IFERROR(value, value_if_error)
Example
This example shows how IFERROR replaces an error with a friendly message. Suppose cell A1 has 10 and B1 has 0. Dividing A1 by B1 causes a division error. Using IFERROR helps:
excel
=IFERROR(A1/B1, "Cannot divide by zero")Output
Cannot divide by zero
Common Pitfalls
Common mistakes include:
- Not using
IFERRORwhen a formula might cause errors, leading to ugly error messages. - Using
IFERRORtoo broadly, which can hide real problems in your data. - Forgetting to provide a meaningful
value_if_error, which can confuse users.
Here is a wrong and right way:
excel
Wrong: =IFERROR(A1/B1)
Right: =IFERROR(A1/B1, "Error: Check inputs")Quick Reference
| Part | Description | Example |
|---|---|---|
| value | Formula or expression to check | A1/B1 |
| value_if_error | Result if error occurs | "No result" or 0 |
Key Takeaways
Use IFERROR to replace error messages with friendly text or values.
Always provide a clear value_if_error to explain or handle errors.
Avoid hiding errors that need fixing by using IFERROR carefully.
IFERROR works with any formula that might produce an error.
It keeps your spreadsheet clean and easier to read.