Formula Overview > What is a Formula? > Sample Formula |
Use the SetFormula method in the Column, Row, or Cell class for specifying the formula for a column, row, or individual cell respectively. Use the SetArrayFormula method for an array formula. Returning the value of the Formula property for these classes provides a string containing the written expression of the formula, for example, SUM(A1:B1).
In code the setting of a formula would look something like this in Visual Basic .NET (for illustration purposes only):
FpSpread1.ActiveSheet.Cells(2, 0).Formula = "SUM(A1:A10)"
or something like this in C#:
fpSpread1.ActiveSheet.Cells[2, 0].Formula = "SUM(A1:A10)";
and if added in the cell by the end user:
=SUM(A1:A10)
In this documentation, where examples are shown, the formula appears as:
SUM(A1:A10)
or
SUM(3,4,5) gives the result 12
to express that the result of the formula would display the value of 12 in the cell.
Keep these ways of expressing a formula in mind when looking at the examples in this documentation. Refer to the specific product Assembly Reference for more details on the Formula property for that product and the exact code syntax to use. Refer to the Developers Guide for that product to find more examples and discussion of formulas.
Return to the What is a Formula?
Return to the Formula Overview.