How to save a sort order?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,676
Office Version
  1. 365
Platform
  1. Windows
Is there any way to "save" a sort order involving multiple columns? For example, suppose I have a table containing the medal count for each country in the Olympics. The table has 5 columns: Country, Gold, Silver, Bronze, & Total.

Olympic Medals.xlsx
EFGHI
5CountryGoldSilverBronzeTotal
6Austria45413
7Norway53412
8Canada14712
9ROC23611
10United States45110
11Germany6309
12Netherlands4318
13Italy2428
14Sweden4127
15Japan1247
20220211 (2)


The normal sort order involves all 4 columns:

1644650915257.png


If I want to sort it some other way (alphabetically by country, by gold medals only, etc.), it is a royal pain to get it back to the normal (original) order.

Is there any way I can "save" that order under a name that I can get by simply choosing that name?

This page seems to indicate that there is not a way to save a sort. It offers a kludgy work-around involving another column in the table:

Sort saving workaround

This is my implementation of this workaround. It works, but is not pretty.

Olympic Medals.xlsx
EFGHIJ
5CountryGoldSilverBronzeTotalSort
6Austria45413013 04 05 04
7Norway53412012 05 03 04
8Canada14712012 01 04 07
9ROC23611011 02 03 06
10United States45110010 04 05 01
11Germany6309009 06 03 00
12Netherlands4318008 04 03 01
13Italy2428008 02 04 02
14Sweden4127007 04 01 02
15Japan1247007 01 02 04
20220211 (2)
Cell Formulas
RangeFormula
J6:J15J6=TEXT([@Total],"000") & TEXT([@Gold]," 00") & TEXT([@Silver]," 00") & TEXT([@Bronze]," 00")
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Jennifer
Don't hate me for this. :) But with Power Query you can add an index column as follows

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    #"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type),
    #"Sorted Rows" = Table.Sort(#"Added Index",{{"Country", Order.Ascending}})
in
    #"Sorted Rows"

Book1
ABCDEFGHIJKL
1CountryGoldSilverBronzeTotalCountryGoldSilverBronzeTotalIndex
2Austria45413Austria454130
3Norway53412Canada147122
4Canada14712Germany63095
5ROC23611Italy24287
6United States45110Japan12479
7Germany6309Netherlands43186
8Netherlands4318Norway534121
9Italy2428ROC236113
10Sweden4127Sweden41278
11Japan1247United States451104
Sheet2


Once you bring the data back to Native Excel, you can then filter on any field and can bring the data back to the original form by sorting on the index column.
 
Upvote 0
Jennifer
Don't hate me for this. :) But with Power Query you can add an index column as follows

I don't hate you. I hate myself for being too lazy to study up on Power Query after you have taken the time to tell me how many problems it solves. ?????

I guess I have procrastinated long enough. Time to get serious. Thanks
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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