PivotFormulas.Add method (Excel)
Creates a new PivotTable formula.
Syntax
expression.Add (Formula, UseStandardFormula)
expression A variable that represents a PivotFormulas object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Formula | Required | String | The new PivotTable formula. |
UseStandardFormula | Optional | Variant | A standard PivotTable formula. |
Return value
A PivotFormula object that represents the new PivotTable formula.
Example
This example creates a new PivotTable formula for the first PivotTable report on worksheet one.
Worksheets(1).PivotTables(1).PivotFormulas _
.Add "Year['1998'] Apples = (Year['1997'] Apples) * 2"
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.