The ERROR.TYPE function takes just one argument, error_val, which is expected to be an Excel error like #VALUE!, #DIV/0!, #NAME!, etc. When error_val is an error, ERROR.TYPE returns a numeric code. If error_val is not an error, ERROR.TYPE returns an error itself: the #N/A error. In most cases, error_val will be supplied as a reference to a cell that may contain an error value.

Examples

If cell A1 contains displays the #DIV/0 error, then ERROR.TYPE will return 2: If cell A1 displays the #N/A error, ERROR.TYPE returns 7 If cell A1 displays no error, ERROR.TYPE returns #N/A One way to use ERROR.TYPE is to test for specific errors and display a custom message when certain error conditions exist. For example, to test for a #DIV/0! error in cell A1 and display a custom message when present, you can use a formula like this: This formula returns an empty string ("") when no error is present, and the message “Missing value” when A1 contains #DIV/0!. Other errors are displayed normally.

Errors and codes

Other error functions

Excel provides a number of error-related functions, each with a different behavior:

The ISERR function returns TRUE for any error type except the #N/A error. The ISERROR function returns TRUE for any error. The ISNA function returns TRUE for #N/A errors only. The ERROR.TYPE function returns the numeric code for a given error. The IFERROR function traps errors and provides an alternative result. The IFNA function traps #N/A errors and provides an alternative result.

Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.