Name

pivottable.AddDataField(Field, [Caption], [Function])

Synopsis

Adds a field to the data area of a pivot table.

Argument

Settings

Field

The PivotField to add to the data area.

Caption

A name to display for the field.

Function

An xlConsolidationFunction constant indicating the type of calculation to perform on the data field items. Can be one of these settings: xlAverage, xlCountNums, xlMin, xlStDev, xlSum, xlVar, xlCount, xlMax, xlProduct, xlStDevP, or xlVarP.

See the preceding topic for an example of how to add a data field.

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.