跳到主要内容

ISERR

检查值是否为 #N/A 以外的错误,并返回 truefalse

语法

expression.ISERR(arg1);

expression - 表示 ApiWorksheetFunction 类的变量。

参数

名称必需/可选数据类型默认值描述
arg1必需number | string | boolean | ApiRange | ApiName要测试的值。值可以是空单元格、错误、逻辑值、文本、数字、区域或区域名称。

返回值

boolean

示例

此示例演示如何检查值是否为 N/A 以外的错误,并返回 true 或 false。

// How to check if the cell contains an error and not N/A value.

// Use a function to check whether the value is error or not and is not N/A.

const worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
worksheet.GetRange("B3").SetValue("45")
let result = func.ISERROR("B3");
worksheet.GetRange("C3").SetValue(result)