Module
Contents
Index 🔎︎

## MONTH

Returns a number representing a specific Error type, or the error value #N/A, if there is no error.

### 语法

ERROR.TYPE(Error_value)

Error_value – required argument. The error value or a reference to a cell, whose value needs to be processed.

Error value | Returns
Err:511 | 1
#DIV/0! | 2
#VALUE | 3
#REF! | 4
#NAME? | 5
#NUM! | 6
#N/A | 7
Anything else | #N/A

This function is part of the Open Document Format for Office Applications (OpenDocument) standard Version 1.2. (ISO/IEC 26300:2-2015)

### 示例

#### Simple usage

=ERROR.TYPE(#N/A)

Returns 7, because 7 is the index number of the error value #N/A.

=ERROR.TYPE(A3)

If A3 contains an expression equivalent to the division by zero, the function returns 2, because 2 is the index number of the error value #DIV/0!

#### More advanced way

If in division A1 by A2, A2 can turn to zero, you can handle the situation as follows:

=IF(ISERROR(A1/A2);IF(ERROR.TYPE(A1/A2)=2;"分母不能为零");A1/A2)

ISERROR 根据是否出错来返回 TRUE 或 FALSE。如果发生错误，函数 IF 将执行第二个参数，而如果没有错误，IF 将返回第三个参数，即除法的结果。第二个参数检查特定错误类型的索引号，如果等于 2，则返回指定文字内容「分母不能为零」，否则返回 0。因此，如果除数为零，则显示明确的说明文字，如果除法成功执行，则出现除法的结果，或者，假如出现其他类型的错误，则返回 0。

If the ERROR.TYPE function is used as condition of the IF function and the ERROR.TYPE returns #N/A, the IF function returns #N/A as well. Use ISERROR to avoid it as shown in the example above.

相关主题

ISERROR, NA, IF

Error codes