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

arg1booleandefault: null

Is any value or expression that can be evaluated to TRUE or FALSE.

arg2anydefault: 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.

arg3anydefault: 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));

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).