In this tutorial, you will learn how to undo a sort in Excel and Google Sheets.
Undo a Sort With the Undo Command
Say you have the data set below that is sorted by Month (Column D) first and by Product (C) second.
If you now sort it by SKU (Column B) and want to undo that sort, the easiest way is to use Undo button in the Quick Access Toolbar (or use the keyboard shortcut CTRL + Z).
As a result, data are again sorted by month and product. However, this option has constraints, as you can use it just after the sort. If you save or close the file, there is no option to use the undo button to undo the sort.
Undo a Sort Using Index Column
The alternative way to enable to undo a sort in every moment is to initially add one column at the beginning of the data set and use it as a unique index for every row.
1. Right-click on the Column B heading and click Insert.
2. Enter a unique number for each row (e.g., 1, 2, 3, etc.).
3. Now sort data by SKU (Column C).
4. To undo a sort, just sort data again by Index (Column B). Click anywhere in the index column (B2:B17), and in the Ribbon, go to Home > Sort & Filter > Sort Smallest to Largest.
Finally, data is again sorted as initially (by Month). Using this method, you can undo a sort at any time.
NOTE: VBA code can also be used to undo a sort in Excel.
Undo a Sort in Google Sheets
You can use either of the ways above to undo a sort in Google Sheets.