Change Count to Sum in Pivot Table

sabrina0034

New Member
Joined
Dec 8, 2009
Messages
32
Hi All - I have a pivot table with many, many columns, and each time I make the pivot table, all the data within the columns comes through as 'count' even though the data itself is numbers in number format. So what happens is that I have to manually change each column to 'sum' by double-clicking on the column header and manually selecting 'sum' for each one! :mad:

Does anyone know how to simultaneously change all columns to 'sum', in one shot?

Don't know if it matters, but I'm working in Excel 2007.

Thanks in advance,
Sabrina
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You could use some basic code to update the Pivot fields, eg:

Rich (BB code):
Sub SET_PTFIELDS_TO_SUM()
    Dim PT As PivotTable, ptField As PivotField
    Set PT = ActiveSheet.PivotTables(1)
    For Each ptField In PT.DataFields
        ptField.Function = xlSum
    Next ptField
    Set PT = Nothing
End Sub

Modify that in red to reflect your set up (so as to fire against the appropriate Pivot table)
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top