Add Method (CalculatedFields or CalculatedItems Collection)
Applies To
CalculatedFields collection object, CalculatedItems collection object.
Description
Creates a new calculated field or calculated item. Returns a PivotField or PivotItem object.
Syntax
object.Add(Name, Formula)
object Required. An expression that returns a CalculatedFields or CalculatedItems object.
Name Required String. The name of the field or item.
Formula Required String. The formula for the field or item.
Example
This example adds a calculated field to PivotTable one.
Worksheets(1).PivotTables(1).CalculatedFields.Add "PxS", _
"= Product * Sales"