Keep Rows Together During Sort in Excel & Google Sheets
This tutorial demonstrates how to keep rows together during a sort in Excel and Google Sheets.
Sort and Keep Rows Together
When sorting data by a column in Excel, you must expand the selection to keep rows together. In this example, you have data in Columns B–G, and you want to sort it by Total Sales (Column G) from largest to smallest.
- Select Column G (click on the letter G in the column heading). Then in the Ribbon, go to Home > Sort & Filter > Sort Largest to Smallest.
- In the Sort Warning window, select Expand the selection, and click Sort.
Along with Column G, the rest of the columns are also sorted, so all rows are kept together. This technique works for any sort, including sorting by date or sorting alphabetically.
Note: When you’re working with a table or filtered range, all rows are kept together automatically, and there is no need to expand the selection.
Sort and Keep Rows Together in Google Sheets
- Select the data range you want to sort (B2:G9), and go to Data > Sort range.
- In the pop-up window, check Data has header row, choose Total Sales under the Sort by menu, select Z → A, and click Sort.
Now the data range is sorted by descending Total Sales, with all rows kept together.