Microsoft Excel Group Rows: How It Works and When to Use It

How-to basics · Updated November 3, 2026

Microsoft Excel Group Rows: How It Works and When to Use It

To group rows in Microsoft Excel for Microsoft 365 on Windows, select the row numbers you want to group, then choose Data > Group. Excel adds an outline control beside the worksheet so you can collapse those rows to a summary or expand them again; grouping does not delete or change their contents.

What grouping rows does

Row grouping is an outlining feature for organizing a worksheet into sections. It is useful when a report contains detail that readers sometimes need to inspect and sometimes need to hide from view. For example, a monthly sales report could show a total for each quarter while allowing readers to collapse the three monthly detail rows beneath it.

When a group is expanded, its rows remain visible and editable. When collapsed, Excel hides the grouped detail rows and displays an outline button, usually a plus sign, that can reopen them. Numbered outline buttons at the left of the sheet show different levels of detail. This changes the worksheet view, not the underlying data: formulas can still refer to hidden rows, and collapsing a group does not remove or filter out its values.

Grouping is different from merging cells, which combines cells into a larger display area, and from sorting, which rearranges records. It is also different from a filter: a filter shows or hides records based on criteria, while an outline lets you show or hide a section you have defined.

How to group rows step by step

  1. Make sure the rows you want to group are next to one another. If needed, insert or rearrange rows first so the section is contiguous.
  2. Select the row headers by clicking the number of the first row and dragging through the number of the last row. For example, drag from row 5 through row 9 to select rows 5–9. You can also select cells in those rows, but selecting row headers makes the intended operation clearer.
  3. Open the Data tab and choose Group in the Outline area. If Excel asks whether to group rows or columns, choose Rows.
  4. Look for the outline controls beside the row numbers. Click the minus button to collapse the group; click its plus button to expand it again.

For a quick Windows shortcut, select the rows and press Alt+Shift+Right Arrow to group them. To ungroup a selection, press Alt+Shift+Left Arrow. Shortcuts can depend on keyboard layout and Excel configuration, so the Data tab is a dependable alternative. On a Mac, use Data > Group from the ribbon if the Windows shortcut does not apply; shortcut availability can vary by keyboard and Excel version.

How outline levels and collapse buttons work

Excel’s outline controls let you change how much detail is visible. The numbered buttons at the top-left of the outline area represent levels: clicking a level displays rows at that level and hides detail below it. The plus and minus buttons beside a group affect that particular section. A report with several groups can therefore be opened or collapsed section by section, or summarized at a broader outline level.

Outline levels can be nested, up to eight levels for rows. For instance, a yearly report might have individual transactions inside monthly groups, months inside quarterly groups, and quarters inside a yearly section. This hierarchy is most useful when each group has a clear parent section. Avoid creating many levels just because Excel allows them; readers can lose track of which plus or minus button controls which detail.

Excel normally places a summary row below the detail rows it summarizes. In that arrangement, grouping the detail rows above the summary leaves the total visible when the detail is collapsed. If a worksheet instead puts summaries above detail, Excel’s outline settings can adjust the summary-row direction. The summary is still a worksheet row with its own contents; grouping does not create a total automatically.

Creating nested groups for a report

To build a hierarchy, group the smallest sections first, then group the larger spans that contain them. Suppose rows 2–13 contain three months of data, with four detail rows per month and a monthly total immediately after each set. First group each month’s detail rows, leaving each monthly total outside that small group. Then group the monthly sections together if you want a higher-level quarter view. The exact ranges depend on where the summary rows sit.

Plan the layout before grouping. A readable outline usually has:

  • Detail rows together in a continuous block.
  • A clearly labeled subtotal or summary row outside the detail group, so it remains visible when that group is collapsed.
  • Consistent spacing and labels that make each section understandable without opening every group.

After creating the outline, click the level buttons and inspect the result. If a summary disappears when you expected it to remain visible, the summary row may have been included in the wrong group, or the outline direction may not match the worksheet layout. Ungroup and rebuild that section rather than hiding rows manually in a way that conflicts with the outline.

Automatic outlines and the Subtotal feature

Excel can create groups from a structured layout. On Windows, open Data > Group and choose Auto Outline when that command is available. Auto Outline looks for summary formulas that refer to detail rows and uses the relationships it finds to build an outline. It works best when a worksheet has a consistent, recognizable structure; irregular layouts or formulas that do not clearly identify detail sections may not produce the intended result. Review the generated groups before sharing the workbook.

The Subtotal command is a different, more automatic workflow for list-style data. It can insert subtotal rows at changes in a chosen field and create an outline around the resulting detail. For example, a sorted list of orders can be subtotaled by salesperson. This is not the same as simply grouping existing rows: Subtotal adds summary rows and formulas, so use it when you want Excel to generate those summaries, not merely hide and show sections you have already arranged. In Excel for Microsoft 365 on Windows, find it on the Data tab in the Outline area; the command is generally intended for a regular range rather than an Excel table.

Ungrouping, clearing an outline, and hiding rows

To remove a group but keep its data, select the grouped row headers and choose Data > Ungroup. If Excel asks what to ungroup, select Rows. Ungroup removes the outline relationship; it does not delete the selected rows or their contents. You can also use the Windows shortcut Alt+Shift+Left Arrow.

To remove all outline groups from a worksheet, use Data > Ungroup > Clear Outline. This clears the outline structure, so it is a broader action than ungrouping one selected section. It does not remove the underlying worksheet data. If you only want to show the hidden rows temporarily, expand the relevant groups instead of clearing the outline.

Manual hiding is another option: select row headers, right-click, and choose Hide; to reveal them, select the surrounding rows, right-click, and choose Unhide. Hiding has no outline hierarchy or built-in section buttons. Grouping is usually better for a report readers will revisit, while manual hiding can suit a one-off view. Neither method is a security measure: hidden worksheet content can still be accessed by someone with the workbook.

Common problems and how to fix them

  • No plus or minus buttons appear: Check that the rows were grouped and that outline symbols are enabled. In Excel for Windows, open File > Options > Advanced, find the display options for the worksheet, and ensure Show outline symbols if an outline is applied is selected. The exact location can vary slightly by Excel build.
  • The wrong direction is grouped: If you selected cells rather than row headers, Excel may ask whether to group rows or columns. Choose Rows. If the wrong outline was created, use Ungroup and repeat the operation with the correct selection.
  • A subtotal vanishes along with the detail: Check whether the subtotal row was included inside the group. Adjust the selected rows so the summary remains outside the detail group, or review whether summaries are positioned above or below detail.
  • Groups seem to overlap or behave unexpectedly: Look for nested groups and existing hidden rows. Use the outline level buttons to reveal the structure, and expand sections before changing them. In complicated sheets, clearing the outline and rebuilding a simpler hierarchy may be easier, but clear only after confirming you do not need the existing grouping.
  • Grouping is unavailable or does not behave as expected: Check whether the worksheet is protected or whether the data is in a layout that does not support the command being used. Some commands, including Subtotal, are not intended for Excel tables. If editing a shared or browser-based workbook, open it in desktop Excel when you need the full set of outlining controls.

Excel for Mac and Excel for the web

In Excel for Mac, select the row headers and use the Data tab’s Group command. Ribbon labels and the placement of outline controls can differ slightly between Mac and Windows, but the basic idea is the same: select adjacent rows, group them, and use the outline buttons to collapse or expand the detail. If a Windows keyboard shortcut is not recognized on your Mac, use the ribbon command rather than assuming the key combination is identical.

Excel for the web can work with row outlines, although the available commands and interface may differ from desktop Excel. Look on the Data tab for grouping controls; if the workbook’s outline cannot be edited as needed in the browser, open it in the desktop app. When a workbook will be used across platforms, check that the outline remains understandable after saving and reopening it in the versions your audience uses.

When grouping is the right choice

Choose grouping when you want a stable, manually defined hierarchy of detail and summaries. Use filters when people need to find records by values such as date, region, or status. Use a PivotTable when readers need to rearrange categories, calculate summaries, or explore a dataset interactively. Use manual hiding for a simple temporary display change, and use Subtotal when a sorted list needs inserted subtotal formulas and outline levels.

For example, a project plan with task rows under fixed phases is a good candidate for grouping: readers can collapse completed or detailed phases without changing the plan’s order. A large transaction list that must be viewed by different customers or dates is usually better handled with filters or a PivotTable. Picking the feature that matches the reader’s task makes the workbook easier to navigate and less likely to confuse hidden detail with missing data.

Frequently Asked Questions

Can I group non-adjacent rows in Excel?
Excel row groups are designed around contiguous sections. For separate sections, create a separate group for each block of adjacent rows. If the rows must be shown or hidden based on a shared value rather than their position, use a filter instead.

Does grouping rows hide them permanently?
No. Collapsing a group hides its detail rows from the current view, and the outline controls let you expand them again. The data remains in the worksheet, and formulas may still include those values.

How do I collapse every group at once?
Click the outline level button for the summary level, often level 1, at the top-left of the worksheet. The exact result depends on how the outline was built. Click a more detailed level or the plus buttons to reveal sections again.

Can I group rows that contain formulas?
Yes. Grouping changes visibility, not cell formulas. If you want a subtotal to stay visible while its detail is collapsed, keep that summary row outside the group of detail rows.

What is the difference between Group and Subtotal in Excel?
Group creates an outline around rows you select. Subtotal can insert summary rows and formulas at changes in a selected field, then outline the detail. Use Group when the summary layout already exists; use Subtotal when you want Excel to generate summaries for a suitable sorted range.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.