Calculation Property

Applies To

Application object, PivotField object.

Description

Application object: Returns or sets the calculation mode. Can be one of the following XlCalculation constants: xlCalculationAutomatic, xlCalculationManual, or xlCalculationSemiautomatic.

PivotField object: Returns or sets the type of calculation done by the specified pivot field. Can be one of the following XlPivotFieldCalculation constants: xlDifferenceFrom, xlIndex, xlNormal, xlPercentDifferenceFrom, xlPercentOf, xlPercentOfColumn, xlPercentOfRow, xlPercentOfTotal, or xlRunningTotal. Valid only for data fields. Read/write Long.

See Also

CalculateBeforeSave property.

Example

This example causes Microsoft Excel to calculate workbooks before they are saved to disk.

Application.Calculation = xlCalculateManual
Application.CalculateBeforeSave = True
This example sets the data field in the PivotTable on Sheet1 to calculate the difference from the base field, sets the base field to the field named "ORDER_DATE," and sets the base item to the item named "5/16/89."

With Worksheets("Sheet1").Range("A3")    .PivotField
    .Calculation = xlDifferenceFrom
    .BaseField = "ORDER_DATE"
    .BaseItem = "5/16/89"
End With