TRY NEW VERSION

ISFORMULA

ISFORMULA(arg1) → { number | string | boolean }

Checks whether a reference is to a cell containing a formula, and returns TRUE or FALSE.

Parameters:

Name Type Description
arg1 ApiRange

Is a reference to the cell you want to test. Reference can be a cell reference, a formula, or name that refers to a cell.

Returns:

Type
number | string | boolean

Example

Copy code
builder.CreateFile("xlsx");

const oWorksheet = Api.GetActiveSheet();

// Set the formula in cell B3
oWorksheet.GetRange("B3").SetValue("=SUM(5, 6)");

// Check if there is a formula in C3
var oFunction = Api.GetWorksheetFunction();
var result = oFunction.ISFORMULA(oWorksheet.GetRange("B3"));
oWorksheet.GetRange("C3").SetValue(result);

builder.SaveFile("xlsx", "ISFORMULA.xlsx");
builder.CloseFile();

Resulting document