Sorting ascending in proper numerical format for a range

WxShady13

Board Regular
Joined
Jul 24, 2018
Messages
184
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I have a LOS Range field (0-1,2-3,4-5,6-7, etc) that I need to sort properly. I have it as a text field so it will show the range but I do not have another field that I can use to sort it numerically. How do I get it to list in proper order?
 
exactly
give me a sec
do you want to sort by first element or both?

and there will be, eg.
1-2
or
99-99
or
123-234
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
is that what you want to achieve?

sort.png
 
Upvote 0
I've to go so adapt these steps to your needs in Power Query Editor - Advanced Editor
Rich (BB code):
    TBD = Table.AddColumn(Previous_Step, "TBD", each Text.PadStart(Text.BeforeDelimiter([LOS Range], "-"), 3, "0"), type text),
    TAD = Table.AddColumn(TBD, "TAD", each Text.PadStart(Text.AfterDelimiter([LOS Range], "-"), 3, "0"), type text),
    SortAsc = Table.Sort(TAD,{{"TBD", Order.Ascending}, {"TAD", Order.Ascending}}),
    RC = Table.RemoveColumns(SortAsc,{"TBD", "TAD"})
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,039
Members
449,063
Latest member
ak94

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