Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pivot table "Sum of" or "Count of"
I have created a macro to create several pivot tables. Some show "Sum of XXX"
and some "Count of XXX". I actually want all to be "Sum of XXX". So how to change the macro to show "Sum of" when the pivot table gives "Count of". Here are codes for one of the tables: With pt1 .PivotFields("REGION").Orientation = xlPageField .PivotFields("DIVISION").Orientation = xlColumnField .PivotFields("YEAR").Orientation = xlRowField .PivotFields("SALES").Orientation = xlDataField End With Thanks, Scott |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pivot table "Sum of" or "Count of"
You can add a bit of code to change all the data fields to SUM:
'================= Dim pf As PivotField For Each pf In pt1.DataFields pf.Function = xlSum Next pf '=============== Scott wrote: I have created a macro to create several pivot tables. Some show "Sum of XXX" and some "Count of XXX". I actually want all to be "Sum of XXX". So how to change the macro to show "Sum of" when the pivot table gives "Count of". Here are codes for one of the tables: With pt1 .PivotFields("REGION").Orientation = xlPageField .PivotFields("DIVISION").Orientation = xlColumnField .PivotFields("YEAR").Orientation = xlRowField .PivotFields("SALES").Orientation = xlDataField End With Thanks, Scott -- Debra Dalgleish Contextures www.contextures.com/tiptech.html Blog: http://blog.contextures.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Create Pivot Table Data with Column "Sum" rather than "count" defa | Excel Discussion (Misc queries) | |||
Pivot Table Report Filter - "OR" instead of "AND" Multiple Filters | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
Pivot table "Group and Show Details" vs. "SubTotals" | Excel Programming |