How to remove automatic sorting from the pivot table in MS Excel(via VBA and Excel)

Anonymous
2025-03-05T11:37:48+00:00

How can we remove the automatic sorting from the pivot table ?
I have some raw data and when I convert it into pivot table, it automatically changes the order of some fields. How to prevent this ?

PFA

As you can see it changed the order of time[row field] automatically. I want the order to be maintained as it was.
How can we achieve this ?

We know it can be achieved by inserting new helpers column but is there any alternative ?

We want to modify only the raw source data without affecting other data. Since this method add and delete columns, it will definitely result in data loss, which we want to avoid.

![](https://learn-attachment.microsoft.com/api/attachments/80744535-8269-4e49-b1f0-b6b9bf60ff17?platform=QnA

Microsoft 365 and Office | Excel | For business | MacOS

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} vote

7 answers

Sort by: Most helpful
  1. Anonymous
    2025-03-18T08:50:03+00:00

    Hi,
    We already tried this way but it doesn't work.
    Is there any other way ?

    Additionally, we want to handle this from VBA.

    0 comments No comments
  2. Jim G 134K Reputation points MVP Volunteer Moderator
    2025-03-18T19:24:03+00:00

    Hi

    Those are the only two sort options.

    Here's the code for VBA: https://www.codevba.com/excel/pivottable/fieldlistsortascending.htm

    0 comments No comments