How to Undo a Sort in Excel & Google Sheets

Written by

Editorial Team

Reviewed by

Laura Tsitlidze

Last updated on June 21, 2023

This tutorial demonstrates 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 dataset below, 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 the Undo button in the quick access toolbar (or use the keyboard shortcut CTRL + Z).

undo sort sorted data 1

As a result, records 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, then left-click Insert.

undo sort index column 1b

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

undo sort index column 2a

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

undo sort index column 3a

  1. 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 methods above to undo a sort in Google Sheets.

undo sort gs

AI Formula Generator

Try for Free

See all How-To Articles