How to Sort by Multiple Columns in Google Sheets (Easiest Way)
Learn how to set two or more sort columns in Google Sheets
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.
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.
Step 3. Select you sort options for the first column from the dialogue box.
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.
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.
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.
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.
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.
Include this row when you sort the data, which will result in the numbers jumbling together when you sort by country and population.
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.
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.