In this tutorial, you will learn 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.
1. 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.
2. In the Sort Warning window, select Expand the selection, and click Sort.
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
1. Select the data range that you want to sort (B2:G9), and go to Data > Sort range.
2. 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.