Excel sort function

Occasional Visitor

We have a job register that now consists of over 3000 rows.  It is a critical part of our business.  The first column consists of the job number and all other columns are relevant to the specific job. 

The numbering system we have used for the job number consists of RE 001, RE 002, RE 003 all the way to RE 1486.  Within this numbering system there are numerous jobs with multiple rows under one RE number such as RE 101 dot 01, RE 101 dot 02 etc.  

Something has happened over the weekend and the rows have been rearranged.  The rows go from RE 001 to RE 100, then the next row number is RE 1000 to RE 1009, then the next number is RE 101, followed by RE 1010, RE 1011, RE 1012.  We have tried numerous ways of using the sort function on excel but we are unable to get the spreadsheet back to the way it was. 

2 Replies



can you share the workbook with the numbers i'm sure the numbers are not confidential just replace the job names with job01 job02 ..etc

@Gizwol79 Combining the "RE " and a number creates a text. So, now you are sorting texts and "RE 101" gets sorted after "RE 1009" just like "AB" would be sorted after "A" but before "B". To avoid this problem, all the codes should have the exact same structure. For example "RE nnnn.nn", meaning RE followed by 4 numbers, then a dot and then 2 more numbers.


But for now, to sort the rows back into their original order, you need to split the RE-codes into three segments, so that you get 3 columns one with only "RE ", another with numbers 1 to 1486  and a third one that may contain numbers 1 to 99.


First save a copy of your current workbooks and work on that one. Insert three columns to the right of the column with the (now incorrectly sorted) RE-codes. Copy the original RE-codes to the first inserted column and select it.


On the Data ribbon, choose Text to Columns. In step 1, choose "Delimited". Next. In step 2 choose "Space". Next. In step 3, in the preview window, click on the second column and select the Text button. Finish.


Now, do something similar with the second column that contains the nnn.nn part. This time, select "Other" in step 2 and enter a dot as the delimiter and in step 3 leave the data types at "General". Finish.


Now you'll have the three columns. On with "RE ", one with real numbers 1 to 1486 and one with real numbers 1 to 99. Let's give these three columns a header. Call them Part1, Part2 and Part3. Something like this:

Screenshot 2021-10-25 at 07.43.47.png

Now select columns with Part2 and Part3. On the Home ribbon, Sort & Filter, Custom Sort. (Sort by) column Part2, Smallest to Largest. Add another sort level (Then by) column Part3, Smallest to Largest. OK. Now, the rows should be in their original places again.


If you want, you can now re-structure the project codes by combining the three columns like this:

Screenshot 2021-10-25 at 07.58.07.png