• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sort Pivot Table by row label values

Vivek D

Member
I need to display a pivot table in tabular form to look just like a normal table as shown below. I need the ability to sort the table by the row labels just like one would be able to with a normal table. Is there a way to do it (VBA solution is fine too)?

e.g. In the below table when I sort by Category C, the table should be sorted by that column i.e. All B1s then all B2 and so on. Ideally, sorted ascending or descending by Sum of Cash as well within each category.
Sort Pivot by Row Labels.png
 

Attachments

  • Sort Pivot by Row Labels.xlsx
    16.4 KB · Views: 4
While not being certain, I doubt you can do this with a pivot table.
Pivot tables usually group data according to the column position left to right. Sorting the whole table by any column not being the leftmost column would upset the grouping; when you choose to sort any column, you sort each sub-grouping separately.
To get the sort order you want, I think you need to put the Category C column at the left. Then you can sort the next column (Category A?) descending by Sum of Cash.

Otherwise, I'd copy the table and paste as values and make it a normal table.
 

Attachments

  • chandoo27718Sort Pivot by Row Labels.xlsx
    17.4 KB · Views: 1
Last edited:
Back
Top