Skip to content

Latest commit

 

History

History
51 lines (31 loc) · 1.34 KB

Excel.CalculatedFields.Add.md

File metadata and controls

51 lines (31 loc) · 1.34 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
CalculatedFields.Add method (Excel)
vbaxl10.chm244078
vbaxl10.chm244078
Excel.CalculatedFields.Add
7c01ebbf-d6a4-2b4d-4740-5cb4e2de826a
04/13/2019
medium

CalculatedFields.Add method (Excel)

Creates a new calculated field. Returns a PivotField object.

Syntax

expression.Add (Name, Formula, UseStandardFormula)

expression A variable that represents a CalculatedFields object.

Parameters

Name Required/Optional Data type Description
Name Required String The name of the field.
Formula Required String The formula for the field.
UseStandardFormula Optional 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.

Example

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

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

[!includeSupport and feedback]