# Product - Sigma Grid 2.0 - Sample

## Formular Cells

When we are talking about formula cell in sigma grid 2.0, we mean a well defined algebraic expression based on grid cells. This algebraic expression refers to some other cells' value. A cell containing a formula displays the result of calculating the formula.

Value in formular cell changes dynamically if the refered cells changes. In the sample above, edit bill cells(2005,2006,2007,2008) and input a new value to see what happens in bill average cell.

function example_initAvg(grid,rn,record){ var bill2005 = grid.getColumnValue('bill2005',rn); var bill2006 = grid.getColumnValue('bill2006',rn); var bill2007 = grid.getColumnValue('bill2007',rn); var bill2008 = grid.getColumnValue('bill2008',rn); var avg =(bill2005+bill2006+bill2007+bill2008)/4; avg = parseInt(avg*100)/100; return avg; } var colsOption = [ {id: 'bill2005' , header: "2005" , width :60, editor: { type :"text"}}, {id: 'bill2006' , header: "2006" , width :60, editor: { type :"text"}}, {id: 'bill2007' , header: "2007" , width :60, editor: { type :"text"}}, {id: 'bill2008' , header: "2008" , width :60, editor: { type :"text"}}, {id: 'bill_avg' , header: "Bill Avg",width :60, initValue : example_initAvg}, ];

## Related Links

Demos List - Customized cell editor - Data validation