Simple Pivot Table Sort Problem

srmorgan

Board Regular
Joined
Apr 18, 2002
Messages
186
Office Version
  1. 365
Platform
  1. Windows
Hello,
I am trying to solve a problem a colleague is having with a simple pivot table.

She has two data elements "Den Rsn Code" and Description. She has two sum values: Count of Den Rsn Code and Sum of Total Balance.
The table is in tabular format. We are using Excel 2016.

We cannot get the table to sort on Sum of Trial Balance. Every sort option seems to only sort based on the Den Rsn Code and/or Sum of Trial Balance.
I have sorted pivot tables by balance in ascending or descending order in the past but I can't work my way through on this one.

I know it is something simple but I am stumped.

Any suggestions?

Thanks to all.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Which of the data fields are you applying the sort to?
 
Upvote 0
Not the value fields, which row field?

If you apply it to the first row field, it will sort by the total balance for each entry in that field. If you sort the second row field, it will only sort each one within the grouping set by the first field.
 
Upvote 0
I am trying to sort the table using Sum of Trial Balance in descending order.
I got it to work, and I don't understand why, starting a new pivot table on a clean worksheet, using the only the Rsn Code as my data field, putting in the sum of trial balance column and sorting on the value field. That worked and I added in the count of code and the description data field to finish it off. At this point it will not sort.
Why does it work using only the first data field and not when the second data field is added in?

In any case thank you for the assistance

SRM
 
Upvote 0
If you sort by the first field, it will sort each group in the first field, but not sort the second field. If you sort the second field, it will only sort within the first field groupings. For example:

[Table="width:, class:head"][tr=bgcolor:#E0E0F0][th] [/th][th]
A
[/th][th]
B
[/th][th]
C
[/th][th]
D
[/th][th]
E
[/th][th]
F
[/th][th]
G
[/th][th]
H
[/th][th]
I
[/th][th]
J
[/th][th]
K
[/th][th]
L
[/th][/tr]
[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
1
[/td][td]Data set[/td][td][/td][td][/td][td][/td][td]Sorted descending using first field[/td][td][/td][td][/td][td][/td][td]Sorted descending using second field.[/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
2
[/td][td]f1[/td][td]F3[/td][td]f2[/td][td][/td][td=bgcolor:#DCE6F1]f1[/td][td=bgcolor:#DCE6F1]F3[/td][td=bgcolor:#DCE6F1]Sum of f2[/td][td][/td][td=bgcolor:#DCE6F1]f1[/td][td=bgcolor:#DCE6F1]F3[/td][td=bgcolor:#DCE6F1]Sum of f2[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
3
[/td][td]a[/td][td]a1[/td][td]
1
[/td][td][/td][td]b[/td][td]a1[/td][td]
16
[/td][td][/td][td]a[/td][td]a2[/td][td]
12
[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
4
[/td][td]a[/td][td]a1[/td][td]
2
[/td][td][/td][td][/td][td]a2[/td][td]
3
[/td][td][/td][td][/td][td]a1[/td][td]
3
[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
5
[/td][td]a[/td][td]a2[/td][td]
3
[/td][td][/td][td]b Total[/td][td][/td][td]
19
[/td][td][/td][td]a Total[/td][td][/td][td]
15
[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
6
[/td][td]a[/td][td]a2[/td][td]
4
[/td][td][/td][td]a[/td][td]a1[/td][td]
3
[/td][td][/td][td]b[/td][td]a1[/td][td]
16
[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
7
[/td][td]a[/td][td]a2[/td][td]
5
[/td][td][/td][td][/td][td]a2[/td][td]
12
[/td][td][/td][td][/td][td]a2[/td][td]
3
[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
8
[/td][td]b[/td][td]a1[/td][td]
11
[/td][td][/td][td]a Total[/td][td][/td][td]
15
[/td][td][/td][td]b Total[/td][td][/td][td]
19
[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
9
[/td][td]b[/td][td]a1[/td][td]
5
[/td][td][/td][td=bgcolor:#DCE6F1]Grand Total[/td][td=bgcolor:#DCE6F1][/td][td=bgcolor:#DCE6F1]
34
[/td][td][/td][td=bgcolor:#DCE6F1]Grand Total[/td][td=bgcolor:#DCE6F1][/td][td=bgcolor:#DCE6F1]
34
[/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
10
[/td][td]b[/td][td]a2[/td][td]
2
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#E0E0F0]
11
[/td][td]b[/td][td]a2[/td][td]
1
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


In the first pivot, sorting the first row field descending will not affect the order of the second field within the first field. In the second one, sorting the second field only applies within the first field grouping, but does not affect how the first field sorts.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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