Sorting Pivot Table

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,601
Office Version
  1. 2021
Platform
  1. Windows
I have a Piviot table with names and have inserted calculated items. I now wish to sort the pivot table by name and Ascending order folows by Comm in asceding order

See Sample date below. It would be appreciated is someone would assist me

Chapter 10 Pivot Tables.Insert Calculated Item.xls
ABCD
3SumofNetProfitMonth
4SalesManagerAug
5Adam70,135
6Andrew175,235
7Bruce125,635
8CommAdam3,507
9CommAndrew8,762
10CommBruce4,397
11CommDavid4,369
12CommDean3,594
13CommHans4,261
14CommKevin7,453
15CommRyan4,893
16David67,214
17Dean95,835
18Hans85,215
19Kevin175,365
20Ryan88,965
21Samantha215,985
Insert Calculated Field
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
try something like this


With pt.PivotFields("Sales Managet")
.AutoSort Order:=xlAscending, Field:="Sum of Net Profit"
End With
 
Upvote 0
Thanks for the help.

When running the macro, run time error 424 occurs, "object required" and the following code is highlighted

With pt.PivotFields("Sales Manager")

It would be appreciated if you could test and amend code
 
Upvote 0
I had corrected your error when I replied in the previous post.

The run time error ocurred with the correction

It would be appreciated if you could test your macro
 
Upvote 0
it is all about object
i did not know what is it your object name, it should be name of your pivotitems name

With pt.PivotFields("Sales Manager").PivotItems("Name of your PitotItem") .AutoSort Order:=xlAscending, Field:="Sum of Net Profit"
End With

try now this
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,291
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