Group Rows in Excel: How to Collapse and Expand Data

How-to basics · Updated November 3, 2026

Group Rows in Excel: How to Collapse and Expand Data

To group rows in Excel for Microsoft 365 on Windows, select the row numbers for the detail rows, then choose Data > Outline > Group. Excel adds outline controls beside the worksheet so you can collapse those rows to a summary and expand them again when you need the detail; grouping does not delete, combine, or move the underlying data.

What grouping rows means

Row grouping is an outline feature for organizing related rows into a section that can be shown or hidden with a control. For example, a monthly report might keep a total row visible while letting readers collapse the transactions that make up the total. A small minus button beside the grouped rows collapses the section; after collapsing, it becomes a plus button that expands it.

Grouping changes how much of the worksheet is displayed, not the data itself. The rows still exist in their original positions, and the values and formulas remain in the cells. A group is useful when readers need both a concise overview and access to supporting detail, without maintaining separate summary and detail sheets.

Excel represents groups using outline levels. The numbered buttons, usually shown as 1, 2, and so on above the row numbers, let you display a particular level of the outline. For instance, level 1 might show only a top-level summary, while a higher level reveals more detail. The exact levels depend on how the groups are arranged.

How to group rows in Excel

Use adjacent rows for each group. If a total or heading should remain visible when the detail is collapsed, leave that row outside the group. A basic workflow is:

  1. Arrange the worksheet so the rows to group are next to one another, with any summary row positioned outside the detail section.
  2. Select the row numbers along the left edge of the sheet for the detail rows. Drag across the row headings, or click the first heading and Shift-click the last one to select a continuous range.
  3. Choose Data > Outline > Group. If you selected cells rather than entire row headings, Excel may show a dialog asking whether to group rows or columns; choose Rows.
  4. Check the outline controls beside the selected rows. Click the minus button to collapse the group and the plus button to show its rows again.

On Windows, Alt+Shift+Right Arrow groups the selected rows or columns. Alt+Shift+Left Arrow ungroups them. These shortcuts operate on the current selection, so check that you have selected the intended rows before using them. On a Mac, use the Data tab’s grouping commands; keyboard shortcuts can differ with Excel version, keyboard layout, and macOS settings.

Make summary rows stay visible

A common layout is a summary row followed by the rows that explain it. Suppose rows 2 through 5 contain January’s transactions and row 6 contains the January total. Group rows 2 through 5, not row 6. When the group is collapsed, the total remains visible; when expanded, the transactions appear above it.

Excel’s outline settings can control whether it expects summary rows above or below detail rows. In desktop Excel for Windows, open the Data tab and use the dialog box launcher in the Outline group to open outline settings. The option for summary rows below detail affects how Excel handles outlines, including some automatic outlining operations. It does not rearrange your worksheet, so plan the row layout and verify the result after grouping.

Keep labels clear. A visible row labeled January total is more useful than a bare number, especially when several sections are collapsed. If the sheet will be printed or shared, test both the expanded and collapsed views so the summary still makes sense without the hidden detail.

Create nested groups for multiple levels

Nested groups let you collapse detail in stages. A yearly report, for example, could have individual transaction rows grouped within each month, with the monthly sections grouped within each quarter. A reader can then show quarter totals, expand a quarter to see month totals, or expand a month to inspect transactions.

Create the smaller groups first, then select the larger ranges that contain them and group those ranges. Excel displays separate outline levels when the groups are nested. Use the numbered outline buttons to choose the level of detail to display, or use the plus and minus controls for one section at a time. Excel supports up to eight outline levels, but a deep outline can be harder to understand than a simple hierarchy; use only the levels that make the worksheet easier to navigate.

Groups work best when the row structure is consistent. If every quarter contains the same kind of monthly summary and detail, readers can predict what expanding a section will reveal. Avoid overlapping group boundaries that do not match the meaning of the data, since those can make the outline controls confusing.

Expand, collapse, and remove groups

Click a minus control to hide a group’s detail rows, and click the resulting plus control to expand it. The numbered outline buttons show or hide detail across the sheet at a selected outline level. These controls affect the current view; they are not a permanent deletion or a replacement for saving the workbook.

To remove a grouping, select the grouped rows and choose Data > Outline > Ungroup. If the worksheet contains several groups, be careful to select the intended range so you remove the right outline level. Excel also offers Clear Outline, which removes the worksheet’s outline structure; use that only when you mean to discard all of its groups, not just collapse them.

If you want the rows visible again but want to keep the group, expand it rather than ungrouping it. Conversely, if you only want to hide a few rows temporarily and do not need outline levels or summary controls, hiding rows may be simpler.

Grouping compared with hiding, filtering, and subtotals

These features can all make a worksheet look shorter, but they solve different problems:

  • Grouping creates an expandable outline for a known set of related rows. It is suited to reports with sections and supporting detail.
  • Hide rows conceals selected rows without adding a structured outline or level controls. It is handy for a temporary view, but less informative when a reader needs to understand how the sheet is organized.
  • Filter displays rows that meet criteria, such as one department or a date range. Filtering is better when the visible records should change according to values, rather than according to a fixed section of the report.
  • Subtotal can insert summary rows and create an outline for grouped data. It is useful for lists organized by a field such as department, but the data generally needs to be sorted by that field first. It is different from simply grouping a manually selected range.

Grouping also does not merge cells, calculate a total, or sort records. If a group should have a sum, average, or count, add the appropriate calculation separately. If rows should be collected by a changing category, consider a filter or PivotTable rather than relying on a hand-built outline.

Common problems and fixes

The Group command is unavailable or the outline controls do not appear. Confirm that the intended rows are selected and that the worksheet is not protected in a way that prevents outline changes. If a sheet is protected, you may need permission from its owner or the password to change its structure. Also check whether outline symbols are hidden: in Excel for Windows, open File > Options > Advanced, find Display options for this worksheet, and enable Show outline symbols if an outline is applied.

The wrong rows disappear. Expand the group, inspect the selected row headings, and group only the detail range. A summary row included in the selection will be hidden along with the detail. Remember that outline controls may affect nested groups, so use the local plus or minus control if you want to change only one section.

The outline is hard to follow. Add descriptive labels to visible summary rows, keep each group contiguous, and avoid grouping blank spacer rows unless they belong to the section. If the worksheet has been reorganized since the groups were created, remove obsolete groups and build the outline again to match the new row layout.

A collapsed sheet looks incomplete to someone else. Save the workbook in the view you intend readers to see, and tell them that the plus signs or outline-level buttons reveal the detail. If a workbook must show every record for review or printing, expand the groups before sharing or printing.

Good uses and practical limits

Grouping is particularly useful for budgets, project plans, departmental reports, and operational summaries where a stable set of detail rows supports a visible total or heading. For example, a project plan could show one row per workstream while allowing readers to expand a workstream to see its tasks. A budget could keep category totals visible while hiding the individual line items until someone needs to inspect them.

It is less suitable when the underlying list changes frequently or when readers need to choose which records appear based on multiple conditions. In those cases, filters, PivotTables, or a separate summary view may be easier to maintain. Grouping is also not a security feature: hiding detail does not protect confidential data. Anyone with access to the workbook may be able to expand the rows or otherwise inspect the sheet, so use appropriate file and worksheet permissions for sensitive information.

Excel for Mac has outline commands on the Data tab, though the ribbon layout and available keyboard shortcuts can differ from Windows. Excel for the web can have a different command layout and may not expose every desktop outline setting. If a particular setting or command is missing, open the workbook in the desktop Excel app and use its Data and Outline controls.

Frequently Asked Questions

Can I group non-adjacent rows together?
Excel outlines are designed for contiguous row sections. For separate sections, create separate groups rather than selecting scattered rows and expecting one group to control them as a single block.

Does grouping rows change or delete their contents?
No. Grouping hides or shows rows in the worksheet view; it does not delete their contents or move them. The data remains in the workbook while the group is collapsed.

How do I group rows without hiding the total?
Select only the detail rows and leave the total row outside the group. For example, group rows 2–5 if row 6 contains the total that should remain visible.

What is the shortcut to group rows in Excel?
In Excel for Windows, select the rows and press Alt+Shift+Right Arrow. To ungroup the selection, press Alt+Shift+Left Arrow. On a Mac, use the Data tab commands if the Windows shortcut does not apply.

How do I remove all row groups?
Use Data > Outline > Clear Outline in desktop Excel to remove the worksheet’s outline structure. This is different from expanding groups, which reveals the rows but keeps the outline in place.

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.