top of page

You are learning Error Handling in MS Excel

How to use the MATCH function with error handling to avoid #N/A errors?

Here are two common ways to use the MATCH function with error handling to avoid #N/A errors in Excel:

1. Using the IFERROR Function:

This method involves nesting the MATCH function within the IFERROR function. IFERROR checks for errors and returns a specified value if an error occurs.

Example:

```excel
=IFERROR(MATCH(lookup_value, lookup_array, match_type), error_value)
```

- lookup_value: The value you're searching for in the lookup array.
- lookup_array: The range of cells you're searching within.
- match_type: Optional argument specifying exact match (0), less than or equal to (-1), or greater than or equal to (1). Defaults to 1 (exact match).
- error_value: The value to return if the MATCH function results in an #N/A error. You can enter a text message (e.g., "Not Found"), a number (e.g., 0), or leave it blank to display an empty cell.

2. Using ISNA and MATCH Together:

This method combines the ISNA function (checks for #N/A errors) and the MATCH function.

Example:

```excel
=IF(ISNA(MATCH(lookup_value, lookup_array, match_type)), error_value, MATCH(lookup_value, lookup_array, match_type))
```

This formula is functionally equivalent to the IFERROR method, but achieves the same result using ISNA to check for the error before running the MATCH function.

Benefits of Error Handling:

- Improves readability and avoids #N/A errors cluttering your spreadsheet.
- Allows you to display a custom message or value when a match isn't found.

Remember:

- Choose the error handling method that best suits your preference and spreadsheet layout.
- Define an appropriate "error_value" to provide meaningful information in case of a missing match.

bottom of page