In this article:

How to Sort by Multiple Columns in Google Sheets (Easiest Way)

December 5, 2024

Structured data often contains several columns for identifying information that can be used to sort the data. These include dates, locations, and customer groups. Google Sheets allows users to set multiple sort columns. In this tutorial, we will learn how to sort by multiple columns in Google Sheets. Are you ready?

Google Sheets Sort by Multiple Columns

Step 1: Select all the data to be sorted.

Our example is using the populations, within the city limits, of the 34 largest European cities. By selecting the entire range, you can sort multiple columns at once by choosing the sorting column or columns and in what order you want to sort.

Data to be sorted.
Data to be sorted

In our Google Sheets sort example, we want to sort by Country first (stored in Column B) then by population (stored in Column B). 

Step 2. Click Data in the main menu, then Sort range -> Advanced range sorting options

Data option in main toolbar, Sort range option, Advanced range sorting options.
Data option in main toolbar, Sort range option, Advanced range sorting options.

Step 3. Select you sort options for the first column from the dialogue box.

Sort range options
Sort range options

If the data has a header row, click the checkbox Data has header row. The label will change to the headers stored in the header rows.

Sort range options. Data has header row checkbox ticked.
Sort range options. Data has header row checkbox ticked.

By default, Google Sheets will only sort by the first column.

In our example, however, we want to sort multiple columns, and our first criterion, the country name, is in Column B. The city name is in column A, but we want to sort first by the country name. Therefore, we clicked on the dropdown menu and select "Country."

Additionally, by default, the sort is in ascending order, indicated as A -> Z in the box. To sort  in descending order, click the button besides Z -> A.

Step 4. Click Add another sort column. 

The same options will appear. In this case, we then sort by the Official Population, which we select in the drop-down box. However, we will sort by the populations by descending order so that the cities with the highest populations in each country will appear first in the sorted data.

Options to sort by multiple columns
Options to sort by multiple columns

Step 5. Repeat Step 4 to add another sort column if necessary.

For our example, we just need two columns. After adding all the necessary columns, click the Sort button.

Our table is now sorted.

Data sorted by multiple columns
Data sorted by multiple columns

Reverting back to original data in Google Sheets

Sometimes, you only want to temporarily sort multiple columns in Google Sheets to find a specific piece of information.

The easiest method to undo sorting immediately is to click the Undo button in the main menu or use CTRL + Z.

However, this option is not always feasible if you have made some edits to the spreadsheet after you sort range by multiple columns.

An easy way to revert back to your original data involves inserting an extra column with each row numbered.

Start by selecting a column and right-clicking, then insert a new column to the left.

Insert new column
Insert new column

Then, you add number that column to correspond to each row of original data.

To do this quickly, type 1, 2, 3 in the first three cells, then select the cells and drag the formatting down the column by clicking and dragging the blue square in the bottom right corner of the three selected cells.

Each data entry numbered to remove sorting
Each data entry numbered to remove sorting

Include this row when you sort the data, which will result in the numbers jumbling together when you sort by country and population.

Sorted data in Google Sheets
Sorted data in Google Sheets

However, this numbered column makes reverting the data a breeze. Simply follow the steps in the tutorial above and only sort by the numbered columns in ascending order.

Sorting by "Reverting," which is the numbered column
Sorting by "Reverting," which is the numbered column

Click sort and voila! Your data will return to its original position.

Reminder: Make sure to sort by ascending order! Descending order will reverse the original order of your order by putting the last entry first.

Other Ways to Sort in Google Sheets

Google Sheets is a brilliant way to manipulate and organize your data. You can sort your data by date, by number, by color, alphabetically, or automatically.

Check out main Google Sheets SORT article to find about everything you need to know to get the most out of Google Sheets.

Google Sheets Sample Sheet

Click here to access our sample spreadsheet with all of our example data.

If you enjoyed this article, you might also like our article on how to use the SORT function in Google Sheets, how to use the Google Sheets sort by number function, or how to use the SORT columns in Google Sheets. 

You can also automatically send an email from Google Sheets. Find out more!

Get Google Sheets productivity and automation tips delivered straight to your inbox
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
We'll email you 1-3 times a week — and never share your information.

Work less, automate more!

Use Lido to connect your spreadsheets to email, Slack, calendars, and more to automate data transfers and eliminate manual copying and pasting. View all use cases ->