Share via


PivotFormulas.Add Method

Excel Developer Reference

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.

Visual Basic for Applications
  Worksheets(1).PivotTables(1).PivotFormulas _
    .Add "Year['1998'] Apples = (Year['1997'] Apples) * 2"

See Also