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

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,400
Office Version
  1. 365
Platform
  1. Windows
To be honest id be changing the source data so the week numbers were shown in the format YYYYWW so they then sort properly.
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,400
Office Version
  1. 365
Platform
  1. Windows
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.
 

VBA_Cancer

New Member
Joined
Nov 6, 2017
Messages
17
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.
 

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,400
Office Version
  1. 365
Platform
  1. Windows
What is actually in the cells that houses the pivot data? Remove all formatting first.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,032
Messages
5,639,649
Members
417,102
Latest member
bcselect

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
Top