Sort two pivot table columns?

Liverlee

Board Regular
Joined
Nov 8, 2018
Messages
73
Office Version
  1. 2019
Platform
  1. Windows
Hi, can anyone let me know if it's possible to sort two columns in a pivot table? For the first column in the pivot table I created a custom list and sorted the data that way, then in column c I tried to sort the data numerically from smallest to largest but the drop down option was to sort a-z, so i created a helper column to rank column c numbers but even though i have the option to sort smallest to largest when i click on the drop down arrow and refresh the data it doesn't sort in rank order.

Any suggestions?

pivot problem.png
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Your pivot table doesn't look right.
Typically a pivot table has all the columns on the right being Numeric. You have Status at the end.
This would indicate you have your 2 value columns in the Row and not the Value area of the pivot table.

If you had the 2 numeric columns in the Value area then when you use More Sort Options on your Task column, you would get the option to sort on New Id or Rank.

Also the Pivot Sorts from left to right. So if you sort Column C it will sort within the Column B groupings. Since most of your Column B items appear to be unique, the sort will appear to have no effect.
 
Upvote 0
??? In a pivottable, you can sort on 1 key, combined keys aren't possible, is it ?
 
Upvote 0
??? In a pivottable, you can sort on 1 key, combined keys aren't possible, is it ?
I am not sure am not misinterpreting your comment but ...

In a pivot table you can sort the rows from left to right but each sort is sub-sort of the previous grouping.
The sorts can be on the field itself or under more sort options on the value fields.
Once you get to a column that is unique eg each group is actually a single row, then further sorts don't do anything.
 
Upvote 0
I just tried something out and wasn't able to do it correct.
I don't understand if i sort on column A ascending, that it doesn't give ABCDEF in that order.
So that was my first step, it's already wrong, but as i understand you, you can subsequently sort the 2nd column for example descending ?
blakenburg
blakenburg.xlsx
ABCDEFGHIJKLM
1col AbcdeSom van e
2CFFD0,471604col AbcdTotaal
3BEDA0,87127CCCB0,340379427
4EEED0,818198CEAC0,755281994
5AFBF0,943924CAEA0,006429316
6BABB0,580679CFFD0,471604224
7FBCD0,678798ECBF0,749979879
8BCFB0,175333EEED0,818198435
9FBCF0,131334EEBC0,358540861
10CEAC0,755282EEDA0,127470025
11FEDC0,573219EBAE0,096941924
12EEBC0,358541AEDD0,874457175
13AEFA0,721581AEFA0,721581368
14CCCB0,340379ADEF0,565548268
15EEDA0,12747AFBF0,943923983
16ADEF0,565548BCFB0,175332747
17DFBA0,401945BEDA0,871270321
18EBAE0,096942BABB0,580679239
19AEDD0,874457BDAC0,035165184
20ECBF0,74998BFCA0,547640265
21FFEA0,973177DCDF0,212320567
22DCDF0,212321DFBA0,401944826
23CAEA0,006429FEDC0,573218542
24FFEE0,379244FBCD0,678798366
25BDAC0,035165FBCF0,131333541
26BFCA0,54764FBFD0,2264505
27FBFD0,22645FFEE0,379244379
28FFEA0,973177088
29Eindtotaal12,61691244
30
Blad1
 
Upvote 0
Sorting the source data doesn't do anything (ie sorting Column A).
When you first create the pivot table it will sort ascending and give the impression the sorting is set ascending.
When you add data to the pivot table you will find things going out of order because under the hood it is actually set to "Manual" sort.
You actually need to go into the pivot table column and explicitly tell it which type of sort you want.

1655024407532.png


What it is doing is probably more obvious when you have grouping values set to not repeat (blank rows if there is no change).
Once you get to a column that has a value on every line, any further sorts don't do anything.


Book2
PQRST
1col AbcdSum of e
2FBCD0.678798366
3F0.131333541
4FD0.2264505
5EDC0.573218542
6FEA0.973177088
7E0.379244379
8EBAE0.096941924
9CBF0.749979879
10EBC0.358540861
11DA0.127470025
12ED0.818198435
13DCDF0.212320567
14FBA0.401944826
15CAEA0.006429316
16CCB0.340379427
17EAC0.755281994
18FFD0.471604224
19BABB0.580679239
20CFB0.175332747
21DAC0.035165184
22EDA0.871270321
23FCA0.547640265
24ADEF0.565548268
25EDD0.874457175
26FA0.721581368
27FBF0.943923983
28Grand Total12.61691244
Sheet1


Showing sorting arrows;

1655025081691.png
 
Upvote 0

Forum statistics

Threads
1,223,657
Messages
6,173,629
Members
452,525
Latest member
DPOLKADOT

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