To group rows under a heading in Excel, leave the heading row outside the selection, select the detail rows beneath it, then choose Data > Group > Group. Excel adds outline controls so you can collapse those rows while keeping the heading visible. Before you start, make sure the rows you want to hide are together and that the worksheet is not protected.
What You’ll Need
- A worksheet with a heading row and the related detail rows directly beneath it. For example, a heading in row 1 followed by its detail in rows 2 through 5.
- Excel for Microsoft 365 on Windows, as described in the steps below. The desktop app is the most reliable option for creating and adjusting row outlines.
- Optional: a saved copy of the workbook if you are making major layout changes. Grouping itself does not change cell values, but it changes how rows are displayed.
Step-by-Step
- Arrange the heading and its details in consecutive rows. Put the heading in its own row, then place the rows it describes immediately below it. Keep the next section’s heading outside the group. For example, if row 1 says Quarterly expenses, rows 2–5 contain expense details, and row 6 starts another section, the rows to group are 2–5. Excel groups adjacent rows; it does not associate a heading with rows based on matching text or formatting.
- Check where Excel places the outline controls. In Excel for Windows, open the Data tab and find the Outline group. Click its small dialog box launcher, then review Summary rows below detail. Clear this setting when the heading is above the rows you are grouping, so the outline control is placed in a useful position for an above-detail heading. This option affects outline placement, not the contents of your worksheet. If you cannot find the launcher, continue to the grouping step and check the result; you can change the setting later if the controls appear below the detail instead of near the heading.
- Select only the detail rows. Use the row-number buttons at the left edge of the sheet. Click row 2, then drag down to row 5, or click row 2 and Shift-click row 5. Confirm that the heading row and the next section’s heading are not selected. Selecting row numbers selects entire rows, which is the clearest way to make a row group. If you select cells instead, Excel may ask whether to group Rows or Columns; choose Rows.
- Create the group. Go to Data > Group > Group. If a dialog appears, select Rows and confirm. Excel adds an outline bracket beside the grouped rows and a small minus button for collapsing them. You can also use the Windows shortcut
Alt+Shift+Right Arrowafter selecting the rows. On Excel for Mac, the equivalent shortcut isOption+Shift+Right Arrow; ribbon labels and layout can vary slightly by release, so use the Data tab if the shortcut does not work. - Collapse the detail rows to check the result. Click the minus button beside the group. The detail rows should disappear from view, while the heading remains visible. The button changes to a plus sign. Click the plus sign to expand the rows again. You can also click the numbered outline level buttons, usually shown as 1, 2, and sometimes higher numbers near the top-left of the worksheet. A lower level displays a more collapsed view; a higher level reveals more detail.
- Adjust the group if the wrong rows disappear. Expand it again, select the correct row numbers, and create a new group after removing the incorrect one. To remove a group without deleting any worksheet data, select its rows and choose Data > Ungroup > Ungroup. If Excel asks whether to ungroup Rows or Columns, choose Rows. Ungrouping removes the outline structure; it does not erase the selected rows or their contents.
- Add groups for other headings as needed. Repeat the same process for each separate section, selecting only that section’s detail rows. You can create nested groups by grouping smaller sets of rows within a larger group, such as individual months inside a year. Expand and collapse the outline to check that each level shows the amount of detail you expect. Keep headings and any totals you want visible outside the detail group.
- Save and check the worksheet in its normal view. Save the workbook, then test both the collapsed and expanded states. If another person will use the file, leave it in the view that makes the structure easiest to understand, and consider adding a brief note that the plus and minus controls expand or collapse sections. Grouping is a display feature: collapsed rows are hidden, not deleted.
Common Mistakes
Including the heading row in the group: If you select the heading along with its details, collapsing the group may hide the heading too. Ungroup the rows, select only the detail rows, and group them again. The heading should sit directly above the selected range if you want it to remain visible when details are collapsed.
Selecting columns or individual cells by accident: Excel can group columns as well as rows. Selecting row numbers makes your intention clear. If the grouping dialog offers Rows and Columns, verify that Rows is selected before confirming.
Expecting grouping to create a heading or calculate a total: Grouping only creates controls to hide and show rows. It does not add a heading, subtotal, or formula. Enter a heading in the worksheet yourself, and use a suitable formula or Excel’s subtotal tools separately if you need calculations.
Confusing grouping with hiding rows: Manually hiding rows does not create an outline group, and grouping does not delete data. Use grouping when you want a repeatable, expandable section. Use Hide only for a simple temporary display change.
Grouping nonadjacent sections together: A group is a continuous range. If unrelated rows sit between two blocks, group each block separately rather than selecting a range that would hide the intervening rows as well.
Tips
Use consistent labels and spacing so it is obvious which rows belong to each heading. A blank row can provide visual separation, but do not include it in a group unless you intend it to disappear with the details. If you have a total row, decide whether it should stay visible when the section is collapsed. Keep that row outside the detail group if it needs to remain on screen.
For a large worksheet, create groups one section at a time and test each one before adding more. Nested groups are useful for layered detail, such as a year-level section containing separate month groups, but too many levels can make the outline difficult to navigate. Excel supports up to eight outline levels for rows, though most worksheets are easier to use with fewer.
Use the outline level buttons when you want to collapse or expand many groups at once. For example, selecting level 1 shows the most summarized outline view, while a higher level reveals additional grouped rows. The exact view depends on how many levels you created. Do not assume that a collapsed view removes information: click the plus sign or choose a more detailed outline level to reveal the rows.
On Excel for Mac, use the Data tab’s Group and Ungroup commands if the ribbon differs from Windows. Excel for the web may show outline controls and grouping commands depending on the available features and workbook. If you cannot find Group or cannot change an existing outline in the browser, open the workbook in the desktop app. The Windows and Mac keyboard shortcuts are useful alternatives, but the ribbon path is easier to verify when working with a selection.
Troubleshooting
The heading disappears when I collapse the group. The heading is probably included in the selected rows. Expand the group, select the row numbers for the details only, and use Data > Ungroup > Ungroup before rebuilding it. Also check that the heading is directly above the details and that the setting for summary rows below detail is cleared when you want outline controls positioned for a heading above its detail.
I cannot see the plus or minus buttons. Check whether the outline symbols are hidden. In Windows, open File > Options > Advanced, find the display options for the worksheet, and enable Show outline symbols if an outline is applied. Also make sure the rows are actually grouped: select a detail row and look for the bracket at the left. If necessary, select the rows again and use Data > Group.
Excel says it cannot group the selection, or the Group command is unavailable. Confirm that you selected adjacent worksheet rows, not a mixed selection of rows and columns. Check whether the sheet is protected; a protected sheet can restrict structural changes. If the workbook is shared or opened in a limited browser view, try opening it in the Excel desktop app. Remove protection only if you have permission and know the password or can otherwise safely change the workbook settings.
The wrong rows collapse, or the outline controls are in an unexpected place. Expand the outline and inspect the row numbers on both ends of the bracket. Ungroup the incorrect range and repeat with the intended rows. Review the Summary rows below detail setting in the Outline settings. That setting controls the outline arrangement; it does not move or rewrite your heading or detail data.
I see several outline levels and do not know how to restore the full sheet. Click the highest-numbered level button visible near the top-left of the worksheet, or click the plus buttons to expand individual groups. If you want to remove the outline completely, select the affected rows and use Data > Ungroup > Clear Outline if that command is available in your Excel version. Clear Outline removes the grouping structure, not cell contents, but it may remove multiple groups at once, so save first if you may want to restore the arrangement.
Frequently Asked Questions
Can I group rows without hiding the heading?
Yes. Keep the heading row outside the group and select only the detail rows below it. If the heading is part of the selected range, it can disappear when the group is collapsed.
Does grouping rows delete or change their values?
No. Grouping adds outline controls and hides or displays rows. The values, formulas, and formatting remain in the worksheet. Expand the group to show the rows again.
Can I group rows that are not next to each other?
Not as one group. Excel groups a continuous range of rows. Create separate groups for separate blocks, or rearrange the sheet if those rows should form one continuous section.
How do I remove a row group?
Select the grouped rows and choose Data > Ungroup > Ungroup, then choose Rows if prompted. To remove multiple outline groups at once, use Clear Outline where available. Neither action deletes worksheet data.
Can I group rows automatically based on a heading?
Not with the basic Group command. You select the detail rows manually. Excel’s automatic outlining features can sometimes infer a structure from formulas and summary rows, but results depend on the worksheet layout; review the outline before relying on it.
Will the grouping work in Excel for the web?
Outline support and editing options can vary in the browser. If you do not see the grouping command or cannot adjust the outline, open the workbook in Excel for Microsoft 365 on Windows or Excel for Mac and make the change there.
Related
- Excel Copy and Paste Slow? Practical Causes and Fixes
- Excel Bar Plot: How to Create and Format One
- Excel Bar Names: What Each Part of the Window Does
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel AutoFit Column Width Shortcut and How It WorksIn Excel for Microsoft 365 on Windows, select the column or columns, then press Alt+H, O, I in…
- How to Enable Solver in Excel on Windows and MacTo enable Solver in Excel for Microsoft 365 on Windows, choose File > Options > Add-ins, select Excel…
- Excel Shortcut to Go to the Top of a Sheet ExplainedIn Excel for Microsoft 365 on Windows, press Ctrl+Home to go to the top-left of the worksheet, normally…
- Excel Sum by Color: How to Total Cells by Fill ColorExcel for Microsoft 365 does not include a built-in SUMBYCOLOR formula. The simplest dependable method is to filter…
- Delete Blank Rows in Excel: Keyboard Shortcut GuideTo delete blank rows quickly in Excel for Microsoft 365 on Windows, select a column that should contain…
- Excel Keyboard Shortcuts: How to Work Without a MouseYes. In Excel for Microsoft 365 on Windows, you can navigate worksheets, select cells, enter and format data,…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.