See all How-To Articles

How to Undo a Sort in Excel & Google Sheets

In this tutorial, you will learn how to undo a sort in Excel and Google Sheets.

 

undo sort initial data 1

 

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.

 

undo sort initial data 1

 

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).

 

undo sort sorted data 1

 

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.

 

undo sort index column 1b

 

2. Enter a unique number for each row (e.g., 1, 2, 3, etc.).

 

undo sort index column 2a

 

3. Now sort data by SKU (Column C).

 

undo sort index column 3a

 

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.

 

undo sort index column 4a

 

Finally, data is again sorted as initially (by Month). Using this method, you can undo a sort at any time.

 

undo sort initial data 1

 

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.