Worksheet.CalculateFormula

CalculateFormula(string)

Calculates a formula.

public object CalculateFormula(string formula)
ParameterTypeDescription
formulaStringFormula to be calculated.

Return Value

Calculated formula result.

See Also


CalculateFormula(string, CalculationOptions)

Calculates a formula expression directly.

public object CalculateFormula(string formula, CalculationOptions opts)
ParameterTypeDescription
formulaStringFormula to be calculated.
optsCalculationOptionsOptions for calculating formula

Return Value

Calculated result of given formula. The returned object may be of possible types of Value, or ReferredArea.

Remarks

The formula will be calculated just like it has been set to cell A1. And the formula will be taken as normal formula. If you need the formula be calculated as an array formula and to get an array for the calculated result, please use CalculateArrayFormula instead.

See Also


CalculateFormula(string, FormulaParseOptions, CalculationOptions, int, int, CalculationData)

Calculates a formula expression directly.

public object CalculateFormula(string formula, FormulaParseOptions pOpts, CalculationOptions cOpts, 
    int baseCellRow, int baseCellColumn, CalculationData calculationData)
ParameterTypeDescription
formulaStringFormula to be calculated.
pOptsFormulaParseOptionsOptions for parsing formula.
cOptsCalculationOptionsOptions for calculating formula.
baseCellRowInt32The row index of the base cell.
baseCellColumnInt32The column index of the base cell.
calculationDataCalculationDataThe calculation data. It is used for the situation that user needs to calculate some static formulas when implementing custom calculation engine. For such kind of situation, user needs to specify it with the calculation data provided for Calculate.

Return Value

Calculated result of given formula. The returned object may be of possible types of Value, or ReferredArea.

Remarks

The formula will be calculated just like it has been set to the specified base cell. And the formula will be taken as normal formula. If you need the formula be calculated as an array formula and to get an array for the calculated result, please use CalculateArrayFormula instead.

See Also


CalculateFormula(CalculationOptions, bool)

Calculates all formulas in this worksheet.

public void CalculateFormula(CalculationOptions options, bool recursive)
ParameterTypeDescription
optionsCalculationOptionsOptions for calculation
recursiveBooleanTrue means if the worksheet’ cells depend on the cells of other worksheets, the dependent cells in other worksheets will be calculated too. False means all the formulas in the worksheet have been calculated and the values are right.

See Also