Bottom line: Learn how to retain and revert to the original sort order of a range or table in Excel.
Skill level: Beginner
Restore the Original Sort Order
Often times we receive a data set that does not have a column of sequential numbers or dates. If we sort one or more columns in the range, it can be difficult or impossible to revert back to the original sort order.
One way to solve this problem is to add a column of sequential numbers to the data set. I typically refer to this as an index column.
After sorting the data you can then go back and sort the index column to restore the original sort order.
Setting up the Index Column
It's important to setup the index column BEFORE you apply any sorting to the data.
Here are the steps to create the index column:
- Type a 1 in a blank column to the right of the data range/table.
- Double-click the fill handle to fill the number down. Checkout this article on the fill handle to learn more.
- Select Series from the Auto Fill Options menu to create a sequential list of numbers 1,2,3,…
- IMPORTANT: If you are NOT using an Excel Table then you will need to reapply the filters to include this new column. This must be done BEFORE you sort the other columns so that the index column is included in the sort.
If you are using an Excel Table then you do not have to worry about step 4. The new column will automatically be included in the table as long as you create it directly to the right of the last column. See the video above for more details.
Checkout my video on a Beginner's Guide to Excel Tables to learn more about the benefits of using this awesome feature of Excel.
Here is another method for using the fill handle.
Checkout my article on Fill Handle Hacks to learn more about this technique.
Other Techniques for Retaining Sort Order?
My friend Robbie asked me this question about retaining sort order the other day, which sparked the idea for this post, and this index column method is the one I've always used.
I've also mentioned it before in my article on how to prevent Excel from freezing when deleting rows.
However, I'm curious to know if you have other techniques or methods to solve this problem. Is there a different or better way?
Please leave a comment below and share your thoughts. Thank you!