top of page

You are learning Error Handling in MS Excel

How to trap errors using the IFERROR function and display a custom message?

Here's how to trap errors using the IFERROR function and display a custom message in Excel:

Syntax:

```excel
=IFERROR(value, value_if_error)
```

Breakdown:

* `value`: This is the formula or expression you want to check for errors.
* `value_if_error`: This is what you want Excel to display if the formula in `value` encounters an error.

Steps:

1. Identify your formula: Start with the formula you want to use. For example, let's say you want to divide the value in cell A1 by the value in cell B1.
2. Wrap the formula in IFERROR: Use the IFERROR function to enclose your formula. For instance:

```excel
=IFERROR(A1/B1, "Error")
```

In this example, `A1/B1` is the formula being checked for errors.

3. Define the custom message: Within the IFERROR function, specify the message you want to display if an error occurs. Here, `"Error"` is the custom message. You can replace it with any text you like (e.g., "Check cell references" or "#N/A").

Explanation:

- If the formula `A1/B1` evaluates without any errors (e.g., division by zero), the result of the formula will be displayed in the cell.
- If `A1/B1` results in an error (e.g., dividing by zero), Excel will display the custom message you defined ("Error" in this case).

Additional Tips:

* You can use empty quotation marks ("") to display a blank cell instead of a custom message if an error occurs.
* The `value_if_error` argument can also be another formula or a cell reference containing the desired message.

By using IFERROR, you can make your spreadsheets more user-friendly and informative, even when errors occur.

bottom of page