Google Sheets Sort Range By Column
Sort Range By Column
Google sheet lets you sort data in a range by columns
It is possible to sort data in a sheet by range.
Note: To sort a range that has more than one column, the whole range of data has to be selected. Sorting just one can breaks the relationship between columns.
This is shown in an example later in this chapter.
The sort commands can be found in the Data menu.
Example (Sort Text)
Sort the Pokemon in the range A2:A21
by their Name, ascending from smallest to largest (A-Z).
Copy the values to follow along.
- Select the range
A2:A21
Note: A1 is not included as it is the header for the column. This is the row that is dedicated to the filter. Including it will blend it with the rest.
- Click on the Data menu and select Sort range by column A, A → Z
This is the result:
Try again, this time with Sort range by column A, Z → A to see what that looks like!
Example (Sort Numbers)
Sort the Pokemon ascending by their Total stats from smallest to largest.
Copy the values to follow along.
- Select the range
A2:A21
- Click on the Data menu and select Sort range by column A, A → Z
This is the result:
Great! The Pokemon were successfully sorted by their Total stats from smallest to largest. The sort commands work for both text and numbers.
A Non-Working Example (Sorting One Column In A Range)
This example shows how sorting column by range can break the relationship between multiple data columns.
In this example we have two columns with related data. Column A
is the Pokemon Names and Column B
is their Total stats. Try sorting just one of the columns (A2:A21
) ascending by their Names.
Copy the values to follow along.
- Select the range
A2:A21
- Click on the Data menu and select Sort range by column A, A → Z
This is the result:
The image above shows that the relationship between column A
and B
is broken. The Pokemon now have wrong Total stats.
Sorting More Than One Column
Select the whole range when sorting ranges with more than one column.
When sorting multiple columns, the sorting is done based on the column with cell having the blue rectangle. This is the cell that you start selecting your range with.
In the image below the sorting is done based on the Name values in column A
In the image below the sorting is done based on the Total stats values in column B
Example
This example shows how to sort data without losing the relationship between the data columns.
Sort the Pokemon based on their names in ascending order.
Copy the values to follow along.
- Select the range
A2:B21
- Click on the Data menu and select Sort range by column A, A → Z
This is the result:
By selecting range A2:B21
the sort is done correctly, keeping the relationship between the data (Column A
and B
).
Now try to sort Pokemon based on their total stats in a descending order.