How To Sort In Google Sheets And Keep Rows Together

Last Updated on November 1, 2023 by Jake Sheridan

In this tutorial, you will learn how to sort in Google Sheets and keep rows together.

How To Sort In Google Sheets And Keep Rows Together

Sorting data in Google Sheets can be a great way to make your data easier to read and analyze. However, when sorting data, you likely want values in the same row to remain together.

For example, imagine you have a list of employee names and contact information. When you sort the list by last name, make sure that the names and contact information stay grouped together.

In this guide, we will show you how to sort data in Google Sheets and keep related rows together.

How To Expand The Selection to Keep Rows Together During Sorting.

Here’s how to expand the selection to keep rows together during sorting.

Step 1

We’ll first explain how to sort an entire row through a Google Sheets function.

This method involves creating a sorted copy of the original dataset.

Start by selecting a blank cell in your spreadsheet. Type the string “=SORT(“ to start the SORT function. The SORT function accepts three main arguments: the range to sort, the index of the column to sort with, and whether you want to sort the row in ascending order.

Step 2

Indicate the cell range you want to sort. In the example below, we’ve selected the range A2:D14.

Step 3

Next, we’ll need to fill out the column to sort with and the order of the sort itself.

We want to sort the range by last name, so we choose the second column in our range. We indicate TRUE in our third argument to sort our values in ascending order.

Step 4

Hit the Enter key to return the sorted values. The SORT function will keep the rows intact after sorting.

Step 5

We can also use the built-in sort range options in Google Sheets.

First, select the range you want to sort. In this example, we’ll sort the range A1:D14.

Step 6

Select the option Data > Sort range > Advanced range sorting options.

Step 7

A dialog box will appear that will ask the user to specify how they want to sort the target range.

If your selection includes the header row, ensure that the Data has header row option is checked. Use the provided dropdown list to select the column you want to sort by. Select whether you want to sort the values from A to Z (ascending order) or from Z to A (descending order).

Hit the Sort option to proceed.

Step 8

Your selected range should now be sorted accordingly. Similar to the previous method, we sort an entire range rather than just a single column. This means that all rows are kept together when sorting.


This guide should be everything you need to sort in Google Sheets and keep rows together.

You may make a copy of this example spreadsheet to test it out on your own.