Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 577
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Pivot Table Data with Column "Sum" rather than "count" defa Johnny_99[_2_] Excel Discussion (Misc queries) 2 January 2nd 10 03:25 PM
Pivot Table Report Filter - "OR" instead of "AND" Multiple Filters tommcbrny Excel Discussion (Misc queries) 1 October 29th 09 03:08 AM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Pivot table "Group and Show Details" vs. "SubTotals" pgchop Excel Programming 0 February 1st 06 07:29 AM


All times are GMT +1. The time now is 04:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"