Purpose

Return value

Syntax

=ERROR.TYPE(error_val)
  • error_val - The error for which to get an error code.

Using the ERROR.TYPE function

The Excel ERROR.TYPE function returns a number that corresponds to a specific error value. You can use ERROR.TYPE to test for specific kinds of errors. If no error exists, ERROR.TYPE returns #N/A. See the table below for a key to the error codes returned by ERROR.TYPE.

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:

=ERROR.TYPE(A1) // returns 2

If cell A1 displays the #N/A error, ERROR.TYPE returns 7

=ERROR.TYPE(A1) // returns 7

If cell A1 displays no error , ERROR.TYPE returns #N/A

=ERROR.TYPE(A1) // 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:

=IF(ISERROR(A1),IF(ERROR.TYPE(A1)=2,"Missing value",A1),"")

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

ErrorCode
#NULL!1
#DIV/0!2
#VALUE!3
#REF!4
#NAME?5
#NUM!6
#N/A7
#GETTING_DATA8
#SPILL!9
#BLOCKED!11
#CALC!14

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.

Purpose

Return value

Syntax

=INFO(type_text)
  • type_text - The information type to return as text.

Using the INFO function

The INFO function can retrieve information about the current environment, including the operating system, the operating system version, Excel version, and so on. INFO takes one argument, type_text , which is a text value indicating the type of information to be returned.

Examples

To use the INFO function, supply the type of information you want as text. For example, to retrieve the operating system, use “system”:

=INFO("system") // returns "pcdos" or "mac"

To request Excel release information, use “release”:

=INFO("release") // returns string like "16.0"

There are seven types of information you can request, summarized in the table below:

TypeInformation
directoryPath of the current directory or folder
numfileNumber of active worksheets in open workbooks
originFirst visible cell at upper left
osversionOperating system version
recalcRecalculation mode
releaseExcel version
systemOperating system name

Note: INFO is a volatile function and will update each time a change is made to the worksheet. This can cause performance problems in larger or more complicated workbooks.