# Built-In Formulas

## Content

You can use built-in formulas in cells. Use the [formula](/spreadjs/api/v17/classes/GC.Spread.Sheets.CellRange#formula) method or [setFormula](/spreadjs/api/v17/classes/GC.Spread.Sheets.Worksheet#setFormula) method to add formulas. You can also specify the reference style with the `referenceStyle` property.

The following code sample sets the  `referenceStyle` property in the  **Workbook**  method.

```javascript
spread.options.referenceStyle = GC.Spread.Sheets.ReferenceStyle.R1C1;
//spread.options.referenceStyle = GC.Spread.Sheets.ReferenceStyle.A1;
```

The following code sample uses the **formula** method.

```javascript
activeSheet.setValue(0,0,1);
activeSheet.setValue(0,1,2);
activeSheet.setValue(0,2,10);
activeSheet.getCell(1,1).formula("=SUM(A1:C1)");
```