Grouping rows in Excel lets you collapse and expand sections of your spreadsheet with a single click
Row grouping is a feature that organizes your data into collapsible sections. When you group rows, Excel adds a small minus sign (or plus sign when collapsed) to the left of your row numbers. Click that button to hide the grouped rows, then click again to show them. This is useful when you have a spreadsheet with subtotals, sections that belong together, or data you want to hide temporarily without deleting it.
The grouping feature works best when your data has a clear structure — for example, sales figures organized by month, or expense categories with line items underneath. You select the rows you want to group, use the Data menu, and Excel handles the rest. The grouped rows stay grouped until you remove the grouping, and you can create multiple levels of grouping in the same spreadsheet.
Key Takeaways
- Select the rows you want to group by clicking the row number of the first row, then holding Shift and clicking the row number of the last row in the group.
- Go to the Data menu, click Group, then choose Group from the dropdown to create the grouping.
- Excel adds numbered buttons (1, 2, 3) on the left side of your spreadsheet that let you collapse or expand all groups at once.
- You can create multiple levels of grouping in the same spreadsheet, and each level gets its own button.
- To remove grouping, select the grouped rows again, go to Data > Group, and click Ungroup.
How to select and group rows step by step
Start by clicking the row number of the first row you want to group. The entire row will highlight in blue. Then hold down the Shift key on your keyboard and click the row number of the last row in the group. All rows from the first to the last will now be selected.
Once your rows are selected, go to the Data menu at the top of the screen. Click it, and a dropdown menu will appear. Look for the word "Group" in that menu and click it. Another small menu will pop up with options; click "Group" again. Excel will immediately add grouping controls to the left side of your spreadsheet, next to the row numbers. A minus sign will appear next to each grouped section, and you will see numbered buttons (usually 1 and 2) above the row numbers on the far left.
If you select non-consecutive rows (rows that are not next to each other), Excel will not let you group them. The rows you group must be adjacent — one right after another.
What those numbered buttons do
The numbered buttons that appear on the left side of your spreadsheet are outline controls. If your spreadsheet has two levels of grouping, you will see buttons labeled 1 and 2. Button 1 shows only the highest level of your data (usually totals or category names). Button 2 shows the first level plus the grouped detail rows underneath.
Click the minus sign next to any group to hide just that section. The rows collapse, and the minus sign becomes a plus sign. Click the plus sign to expand that group again. This is faster than scrolling when you have a large spreadsheet and only want to see certain sections at a time.
If you create three levels of grouping, you will see buttons 1, 2, and 3. Button 1 shows the most condensed view, and button 3 shows everything. This is common in spreadsheets with summary rows, category rows, and detail rows all stacked together.
Creating multiple levels of grouping in one spreadsheet
You can group rows within rows. For example, if you have monthly sales data with weeks inside each month, you can group the week rows together, then group those month groups together. This creates a hierarchy that lets you zoom in and out of your data.
To do this, first group the innermost rows (the weeks, in this example). Then select a larger range that includes those groups plus any rows between them, and group again. Excel will recognize the existing grouping and add a new level on top of it. The numbered buttons will increase — you will now see 1, 2, and 3 instead of just 1 and 2.
The order matters: always group the smallest sections first, then work outward to larger sections. If you try to group in the opposite order, Excel may not create the hierarchy correctly.
Removing grouping when you no longer need it
To remove all grouping from your spreadsheet, select all rows by clicking the box in the top-left corner (where the row numbers and column letters meet). Then go to Data > Group and click Ungroup. A dialog box will ask whether you want to remove the outline. Click OK, and all grouping will disappear.
If you only want to remove one level of grouping (for example, you have three levels and want to keep two), select the rows in that level, go to Data > Group, and click Ungroup. Excel will remove only that level, leaving the others intact.
If you accidentally remove grouping you wanted to keep, press Ctrl+Z (or Cmd+Z on a Mac) immediately to undo the action.
When grouping works best and when it does not
Grouping works best when your data has summary rows or subtotals. For example, if you have a row that says "January Total" followed by rows with individual sales, grouping the detail rows under that total makes sense. When someone clicks the minus sign, they see only the total, and when they click the plus sign, they see the breakdown.
Grouping does not work well if your rows are completely unrelated or if you are trying to hide rows based on their content (like hiding all rows where the value is below 100). For that kind of filtering, use Excel's AutoFilter feature instead, which lets you show or hide rows based on the data they contain.
Grouping also requires that the rows you want to group are next to each other. If your data is scattered across the spreadsheet, you will need to rearrange it first, or use a different method like sorting or filtering.
Grouping in different versions of Excel
The grouping feature works the same way in Excel for Windows, Excel for Mac, and Excel Online. The Data menu is in the same place, and the steps are identical. If you are using an older version of Excel (2010 or earlier), the menu layout might be slightly different, but the Group option is still under the Data menu.
If you are using Google Sheets instead of Excel, the feature is called "Group rows" and works similarly, though the menu path is different. In Google Sheets, you select the rows, then go to Data > Group rows. The collapse and expand buttons appear in the same place on the left side of the spreadsheet.
Frequently Asked Questions
Can I group columns instead of rows?
Yes. The process is identical, except you click column letters instead of row numbers. Select the columns you want to group, go to Data > Group, and click Group. The collapse buttons will appear above the column letters instead of to the left of the row numbers.
What happens to my grouping if I add or delete rows?
If you add rows inside a grouped section, they automatically become part of that group. If you delete rows, the grouping stays in place for the remaining rows. If you delete all rows in a group, that group disappears.
Can I copy a spreadsheet with grouping to another file?
Yes. When you copy and paste a grouped spreadsheet, or when you open a file that contains grouping, the grouping comes with it. The collapse and expand buttons will work the same way in the new location.
Why does Excel say I cannot group these rows?
This usually means the rows you selected are not adjacent (not next to each other), or you have already grouped them. Make sure you are selecting a continuous range of row numbers with no gaps between them.