Skip to main content

COMPLEX

Converts real and imaginary coefficients into a complex number.

Syntax

expression.COMPLEX(arg1, arg2, arg3);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | numberThe real coefficient of the complex number.
arg2RequiredApiRange | ApiName | numberThe imaginary coefficient of the complex number.
arg3OptionalApiRange | ApiName | stringThe suffix for the imaginary component of the complex number. It can be either "i" or "j" in lowercase.\ If it is omitted, the function will assume suffix to be "i".

Returns

number

Example

let worksheet = Api.GetActiveSheet();
let func = Api.GetWorksheetFunction();
worksheet.GetRange("A1").SetValue(func.COMPLEX(-2, 2.5, "i"));