ERROR_TYPE
Returns a number matching an error value.
Syntax
expression.ERROR_TYPE(arg1);
expression - A variable that represents a ApiWorksheetFunction class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| arg1 | Required | ErrorValue | ApiRange | ApiName | The error value for which the identifying number will be returned. It can be an actual error value or a reference to a cell containing an error value. |
Returns
number
Example
This example shows how to return a number matching an error value.
- Code
- Result
// How to get the error type code from the value.
// Use function to get a error type.
const worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
let nonPositiveNum = 0;
let logResult = func.LOG(nonPositiveNum);
worksheet.GetRange("B3").SetValue(logResult);
worksheet.GetRange("C3").SetValue(func.ERROR_TYPE(logResult));