Spread.Sheets Documentation
formula Method
The cell formula.
Gets or sets the formula for the cell.
Syntax
var instance = new GC.Spread.Sheets.CellRange(sheet, row, col, rowCount, colCount, sheetArea);
var returnValue; // Type: any
returnValue = instance.formula(value);
function formula( 
   value : string
) : any;

Parameters

value
The cell formula.

Return Value

If no value is set, returns the cell formula; otherwise, returns the cell.
Example
The following examples set the formula method.
activeSheet.setValue(0,0,1);
activeSheet.setValue(0,1,2);
activeSheet.setValue(0,2,10);
activeSheet.getCell(1,1).formula("=SUM(A1:C1)");
var formula = activeSheet.getFormula(1,1);
alert(formula);
activeSheet.setValue(0, 0, 'abc');
activeSheet.setValue(1, 0, 'ac');
activeSheet.setValue(2, 0, 'a*');
 
activeSheet.getCell(0, 1).formula('COUNTIF(A1:A3,"a*")');  //start with a
activeSheet.getCell(1, 1).formula('COUNTIF(A1:A3,"a?")');  //"a" and only one other character
activeSheet.getCell(2, 1).formula('COUNTIF(A1:A3,"a~*")'); // should be "a*"
activeSheet.getCell(0,2).formula("DATEDIF(DATE(2003,1,1),DATE(2016,1,1),\"Y\")");
Remarks
The default value is null.
See Also

Reference

CellRange type
Using Formulas

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.