Documentation/Calc Functions/ERROR.TYPE

From The Document Foundation Wiki
Jump to navigation Jump to search


Function name:

ERROR.TYPE

Category:

Spreadsheet

Summary:

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

Syntax:

ERROR.TYPE(Error_value)

Returns:

Returns a positive whole number ranging from 1 to 8 or #N/A corresponding to Error_value.

Arguments:

Error_value is an error value or a reference to a cell containing that value, whose value needs to be processed. This value is processed as follows:

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

Additional details:

  • IF and ISERROR functions can be used with ERROR.TYPE passed as a condition to return a string explaining the error instead of a numeric value or error value.

Examples:

Simple usage

Formula Description Returns
=ERROR.TYPE(#N/A) Here 7 is the index number of the error value #N/A. 7
=ERROR.TYPE(A3) where A3 contains an expression equivalent to the division by zero Here 2 is the index number of the error value #DIV/0! 2

More advanced way

Formula Description Returns
=IF(ISERROR(A1/A2);IF(ERROR.TYPE(A1/A2)=2;"the denominator can't be equal to zero");A1/A2) where in division A1 by A2, A2 can turn to zero The ISERROR function returns TRUE or FALSE depending on whether there is an error or not. If the error takes place, the function IF addresses the second argument, if there is no error, it returns the result of the division. The second argument checks the index number representing the specific Error type, and if it is equal to 2, it returns the specified text "the denominator can't be zero" or 0 otherwise. Thus, the clear text would signify the division by zero, the result of the division would appear when the division is successful, or if there is, for example, an error of another type, zero would be returned. If the ERROR.TYPE function is used as a 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. the denominator can't be equal to zero

Related LibreOffice functions:

IF

ISERROR

NA

ODF standard:

Section 6.13.11, part 2

Equivalent Excel functions:

ERROR.TYPE