Is there a way to modify Pivot Table so that "Sum of, Count of", etc is not shown.
For example, have Table (& Pivot Chart) show "West Region" instead of "Sum of West Region"
Thanks
Is there a way to modify Pivot Table so that "Sum of, Count of", etc is not shown.
For example, have Table (& Pivot Chart) show "West Region" instead of "Sum of West Region"
Thanks
Hi
If you right-click on the pivot table and select "Field Settings", you can change the text that is displayed by amending the "Name" field.
Hope this helps!
Best regards
Richard
That worked. Thanks very much
the following code will achieve what you want.
Copy the Code above![]()
Sub ChangePTName() Dim pt As PivotTable, pf As PivotField, ws As Worksheet, i As Long Application.ScreenUpdating = False Set ws = ActiveSheet For i = 1 To ws.PivotTables.Count Set pt = ws.PivotTables(i) pt.ManualUpdate = True For Each pf In pt.DataFields If pf.Function = xlSum Then If Left(pf.Caption, 6) = "Sum of" Then pf.Caption = Right(pf.Caption, Len(pf.Caption) - 6) End If End If Next pt.ManualUpdate = False Next i Application.ScreenUpdating = True End Sub
Alt+F11 to invoke the VB Editor
Insert>Module
Paste code into white pane that appears
Alt+F11 to return to Excel
To use
Select sheet containing the PT's
Alt+F8 to bring up Macros
Highlight ChangePTName
Run
FANTASTIC! Thanks Tal!
Thanks so much!
This has worked perfectly for me and saved me a lot of frustration. Appreciate the simple instructions as well.
Many Thanks
Just used this - really big help - thank you
Is there a version/language independent workaround? For example in dutch "sum of" becomes "Som van". Since i want my macro not to be depended on the language excel is installed, the code above wont work.
This part wont work:
![]()
If Left(pf.Caption, 6) = "Sum of" Then
It is not possible to rename field to same as source field but you may try:
![]()
Sub ChangePTName() Dim pt As PivotTable Dim pf As PivotField Dim ws As Worksheet Dim i As Long Application.ScreenUpdating = False Set ws = ActiveSheet For Each pt In ws.PivotTables pt.ManualUpdate = True For Each pf In pt.DataFields If pf.Function = xlSum Then pf.Caption = pf.SourceName & " " End If Next pt.ManualUpdate = False Next pt Application.ScreenUpdating = True End Sub
- Please remember to mark threads Solved with Thread Tools link at top of page.
- Please use code tags when posting code: [code]Place your code here[/code]
- Please read Forum Rules
Thanks that did the trick!
Joji,
Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
If I have helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Thank you so much, great help!![]()
works, thanks!
Another quick workaround is to replace "Sum of" with a blank space.. or delete it out and put a space after the variable name. If you have a lot of variables you can just Find/Replace "Sum of" with nothing and that will give you the same result.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks