Grouping rows in Excel lets you collapse and expand sections of data without deleting anything
Row grouping in Excel creates a collapsible outline structure around blocks of related data. When you group rows, Excel adds a small minus sign (called a collapse button) to the left margin. Click it to hide those rows; click the plus sign that appears to show them again. The data stays in your spreadsheet — you are just controlling what you see on screen.
This is useful when you have a spreadsheet with subtotals, budget categories, monthly breakdowns, or any repeating structure where you want to zoom in on details or zoom out to see only the summary line. Grouping is not the same as filtering (which hides rows based on a condition) or sorting (which reorders them). Grouping is permanent structure you build into the sheet.
Key Takeaways
- Select the rows you want to group, then use the Data menu to create the group — Excel adds collapse buttons on the left side of the sheet.
- Grouped rows must be adjacent (next to each other); you cannot group non-consecutive rows in a single action.
- You can nest groups inside groups, so a summary row can have detail rows grouped beneath it, and those detail rows can have their own sub-groups.
- Ungrouping removes the collapse buttons but does not delete any data or change the order of rows.
How to select and group rows
Start by clicking the row number of the first row you want to group. Hold Shift and click the row number of the last row in that group. All rows between them will highlight in blue. For example, if you have sales data for January in rows 3 through 7, click row 3, hold Shift, and click row 7.
With the rows selected, go to the Data menu at the top of the screen. Click Group (in newer versions of Excel, this may appear as a button in the Data toolbar; in older versions, it is in the Data menu). A dialog box may appear asking whether you want to group rows or columns — choose Rows. Excel will add a gray bracket and collapse buttons to the left margin.
The collapse buttons appear as a minus sign (−) next to the grouped rows and a plus sign (+) where the group is hidden. Click the minus to collapse; click the plus to expand. You can also click the outline level numbers (usually 1, 2, 3) that appear above the row numbers to collapse or expand all groups at once.
Grouping data with subtotals
If your data has a clear structure — like monthly sales figures with a subtotal row at the end of each month — you can use the Subtotals feature to group automatically. First, sort your data so that all rows belonging to the same group are together. Then select all the data including headers.
Go to Data > Subtotals. Excel will ask you which column to group by (for example, "Month"), what function to use (Sum, Count, Average, etc.), and which columns to calculate. Excel will insert subtotal rows and automatically group the data around them. This is faster than grouping manually if your data is large and well-organized.
The Subtotals feature also creates outline levels. You can click the level numbers on the left to show only the subtotal rows, or expand to see all detail. This is especially useful for budget spreadsheets or sales reports where you want to see monthly totals without scrolling through every transaction.
Creating nested groups for multi-level data
You can group rows within groups to create a hierarchy. For example, you might have a spreadsheet with quarterly sales data: each quarter contains three months, and each month contains individual sales. You would first group the rows for January, then the rows for February, then the rows for March. Then you would select all rows for Q1 (including the three month groups) and group those together.
Excel will display outline level buttons (1, 2, 3, etc.) on the left. Click level 1 to see only the top-level groups, level 2 to see groups and their when ready sub-groups, and level 3 to see everything. This lets you navigate large spreadsheets quickly — collapse to see the big picture, expand to drill into details.
Nested groups work best when your data has a natural hierarchy and the groups do not overlap. If you have a summary row at the end of each group (like a subtotal), make sure that row is not included in the group below it, or the outline structure will be confusing.
Ungrouping rows and removing the outline structure
To remove grouping, select the grouped rows (or click anywhere within the group) and go to Data > Ungroup. The collapse buttons disappear, but all your data remains in place and in the same order. If you have nested groups, you can ungroup one level at a time or ungroup all at once.
If you used the Subtotals feature and want to remove it, go to Data > Subtotals and click Remove All. This deletes the subtotal rows that Excel inserted, not your original data. If you only grouped rows manually (without using Subtotals), ungrouping will not delete anything — it just removes the outline structure.
Common mistakes and how to avoid them
The most common mistake is trying to group non-adjacent rows. If you need to group rows 3–5 and rows 10–12 separately, you must do them in two separate actions. You cannot select both ranges at once and group them together. Each group must be a continuous block of rows.
Another mistake is including a summary row in the group below it. If you have a subtotal row at the end of January data, do not include that subtotal row in the February group. The outline structure works best when each group contains only the detail rows, and summary rows sit between groups or at the top level.
If your outline looks confusing or the collapse buttons are in the wrong place, you may have overlapping groups or groups that do not align with your data structure. Ungroup everything and start over, making sure each group is a clean block of related rows with no overlap.
When grouping is better than filtering or sorting
Use grouping when you want a permanent outline structure that you can toggle on and off. Grouping is ideal for reports you create once and share with others — they can collapse sections they do not need and expand the ones they do. Filtering is better when you want to show only rows that meet a specific condition (like "sales over $1000"). Sorting is better when you need to reorder rows by value or date.
Grouping also works well alongside other features. You can group rows and then filter within those groups, or sort the data first and then group it. The grouping structure stays in place even if you filter or sort, so you can use multiple tools together to organize complex spreadsheets.
Frequently Asked Questions
Can I group rows that are not next to each other?
No. Grouping requires consecutive rows. If you need to group non-adjacent rows, you must create separate groups for each block. You cannot select rows 3–5 and rows 10–12 in one action and group them together.
What happens to grouped rows when I copy and paste the spreadsheet?
The grouping structure copies along with the data. If you copy a grouped range and paste it into a new location, the outline buttons and collapse structure come with it. If you copy only the visible (non-collapsed) rows, only those rows paste.
Can I group columns instead of rows?
Yes. The process is the same — select the column letters instead of row numbers, then go to Data > Group and choose Columns. This is useful for hiding related columns (like monthly detail columns when you only want to see quarterly totals).
Will ungrouping delete my data?
No. Ungrouping removes only the outline structure and collapse buttons. All your data stays in the spreadsheet in the same order. If you used the Subtotals feature and click Remove All, the subtotal rows that Excel inserted will be deleted, but your original data will remain.
How many levels of grouping can I create?
Excel supports up to eight levels of nested grouping. In practice, most spreadsheets use two or three levels — more than that becomes hard to navigate. If you need more than eight levels, your data structure may benefit from being split into separate sheets.