IF
function IF(arg1: boolean = null, arg2: any = null, arg3: any = null): number | string | boolean
Description
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE.
Parameters
- arg1
boolean
null Is any value or expression that can be evaluated to TRUE or FALSE.
- arg2
any
null Is the value that is returned if Logical_test is TRUE. If omitted, TRUE is returned. You can nest up to seven IF functions.
- arg3
any
null Is the value that is returned if Logical_test is FALSE. If omitted, FALSE is returned.
Returns
number | string | boolean
Try It
var oWorksheet = Api.GetActiveSheet();
var oFunction = Api.GetWorksheetFunction();
oWorksheet.GetRange("A1").SetValue(oFunction.IF("12<100", 0, 1));