CalculatedFields.Add Method (Excel)

Office 2010

Creates a new calculated field. Returns a PivotField object.

.Add(Name, Formula, UseStandardFormula)

A variable that represents a CalculatedFields object.

Parameters

Name

Required/Optional

Data Type

Description

Name

필수

String

The name of the field.

Formula

필수

String

The formula for the field.

UseStandardFormula

선택

Variant

False (default) for upward compatibility. True for strings contained in any arguments that are field names, will be interpreted as having been formatted in standard U.S. English instead of local settings.

Return Value

A PivotField that represents the new calculated field.

This example adds a calculated field to the first PivotTable report on worksheet one.

Worksheets(1).PivotTables(1).CalculatedFields.Add "PxS", _ 
 "= Product * Sales"
표시: