Sort does not work properly

%3CLINGO-SUB%20id%3D%22lingo-sub-2671886%22%20slang%3D%22en-US%22%3ESort%20does%20not%20work%20properly%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2671886%22%20slang%3D%22en-US%22%3E%3CP%3EPretext%3A%20I%20know%20this%20has%20been%20done%20to%20death%2C%20but%20my%20problem%20is%20different.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAt%20work%20there%20is%20a%20document%20which%20is%20used%20for%20organizing%20inventory.%20There%20is%20a%20column%20called%20%22Location%22%20(A1)%20where%20they%20go%201A%2C%201B%2C%201C%2C%201D%2C%202A%2C%202B%2C%202C%2C%20....%2C%20120A%2C%20120B%2C%20120C%2C%20where%20the%20last%20character%20indicates%20the%20vertical%20level%20where%20a%20forklift%20stores%20a%20pallet%20loaded%20with%20inventory.%20Not%20all%20numbers%20have%20same%20number%20of%20levels.%20They%20got%20sorted%20out%20of%20this%20order%2C%20and%20now%20I%20cannot%20sort%20them%20back.%20No%20matter%20what%20I%20do%2C%20it%20will%20only%20sort%20these%20numbers%20(after%20removing%20the%20last%20character%2C%20which%20is%20always%20text)%20by%20first%20sorting%20the%20numbers%20with%203%20digits%2C%20then%20the%20numbers%20with%202%20come%20after%2C%20then%20the%20numbers%20with%20only%201%20digit%2C%20whether%20smallest%20to%20largest%20or%20vise%20versa.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20I%20mentioned%2C%20I%20removed%20the%20last%20character%20in%20another%20column%20(Location1)%20so%20to%20make%20them%20all%20numbers.%20Isnumber%20returns%20true%20for%20all%20cells.%20I%20also%20used%20the%20clean%20function%2C%20and%20tried%20multiplying%20by%201.%20Last%2C%20I%20also%20forced%20all%20these%20cells%20to%20have%203%20digits%2C%20e.g.1%20would%20be%20001%2C%20and%20so%20on.%20When%20I%20manually%20type%20some%20of%20these%20kinds%20of%20numbers%20(1%2C%209%2C%2010%2C%2019%2C%20100%2C%20120...)%20and%20sort%2C%20it%20works%2C%20but%20for%20some%20reason%20it%20won't%20do%20it%20to%20the%20cells%20under%20Location1%2C%20that%20manipulates%20cells%20under%20Location.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20got%20some%20of%20the%20ideas%20from%20above%20from%20google%20searches%2C%20but%20I%20don't%20have%20any%20more%20things%20left%20to%20try.%20Any%20help%20is%20appreciated.%20They%20use%20Excel%202016%2C%20and%20there%20is%20no%20possibility%20for%20me%20to%20show%20this%20document%20on%20this%20forum.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2671886%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2672169%22%20slang%3D%22en-US%22%3ERe%3A%20Sort%20does%20not%20work%20properly%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2672169%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1134016%22%20target%3D%22_blank%22%3E%40Gman-actual%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20could%20either%20replace%20the%20column%20or%20add%20a%20column%20with%20leading%200s%20in%20order%20to%20make%20the%20alphabetical%20order%20line%20up%20with%20numerical%20ordering.%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3D%20REPT(0%2C4-LEN(location))%26amp%3Blocation%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3ESorting%20on%20the%20new%20column%20(either%20the%20SORT%20function%20in%20365%20or%20manual%20sort%20in%20older%20versions)%20will%20restore%20your%20original%20ordering.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Pretext: I know this has been done to death, but my problem is different.

 

At work there is a document which is used for organizing inventory. There is a column called "Location" (A1) where they go 1A, 1B, 1C, 1D, 2A, 2B, 2C, ...., 120A, 120B, 120C, where the last character indicates the vertical level where a forklift stores a pallet loaded with inventory. Not all numbers have same number of levels. They got sorted out of this order, and now I cannot sort them back. No matter what I do, it will only sort these numbers (after removing the last character, which is always text) by first sorting the numbers with 3 digits, then the numbers with 2 come after, then the numbers with only 1 digit, whether smallest to largest or vise versa.

 

As I mentioned, I removed the last character in another column (Location1) so to make them all numbers. Isnumber returns true for all cells. I also used the clean function, and tried multiplying by 1. Last, I also forced all these cells to have 3 digits, e.g.1 would be 001, and so on. When I manually type some of these kinds of numbers (1, 9, 10, 19, 100, 120...) and sort, it works, but for some reason it won't do it to the cells under Location1, that manipulates cells under Location.

 

I got some of the ideas from above from google searches, but I don't have any more things left to try. Any help is appreciated. They use Excel 2016, and there is no possibility for me to show this document on this forum.

1 Reply

@Gman-actual 

You could either replace the column or add a column with leading 0s in order to make the alphabetical order line up with numerical ordering.

= REPT(0,4-LEN(location))&location

Sorting on the new column (either the SORT function in 365 or manual sort in older versions) will restore your original ordering.