How to sort week/year column in pivot table correctly?

VBA_Cancer

New Member
Joined
Nov 6, 2017
Messages
17
So I have a pivot table that looks like this

Week/Yeardata1
1 2019454
1 2020545
2 2019454
2 2020343
3 201955


How do I sort the week/year column in pivot table so that it first sort by the year and then the week number so that it looks like this?

wee/yeardata1
1 2019
2 2019
3 2019
4 2019
1 2020
2 2020
3 2020
 

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.
To be honest id be changing the source data so the week numbers were shown in the format YYYYWW so they then sort properly.
 
Upvote 0
A textual number like you have there will not sort properly as you have found. For example 11 comes before 2. You will need to create a number system that sorts properly like the one ive given you.
 
Upvote 0
A textual number like you have there will not sort properly as you have found. For example 11 comes before 2. You will need to create a number system that sorts properly like the one ive given you.
Alright so, I tried to change it to YYYY/WW, but there isn't an option in custom for year follow by week.
 
Upvote 0
What is actually in the cells that houses the pivot data? Remove all formatting first.
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,563
Members
448,972
Latest member
Shantanu2024

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