To group rows in Excel while keeping a header visible, leave the header row outside the group: select only the detail rows, then choose Data > Group. Excel adds an outline control beside the selected rows, so you can collapse or expand the details without hiding the heading above them.
What “Header on Top” Means in Excel
The phrase can mean two different things. You might mean the worksheet’s column labels, such as Date, Item, and Amount, should remain visible while you collapse data. Or you might mean a section heading or summary row should sit above a block of detail rows. Excel can do both, but grouping itself does not create a heading or move a row: it hides and shows the rows you select.
For column labels, keep the label row ungrouped. For a section heading, keep that heading outside the selected detail range. In either case, a row above the group remains visible when the group is collapsed. This is different from freezing a row: an outline keeps selected rows visible by excluding them from the group, while Freeze Panes keeps rows in view as you scroll.
For example, if row 1 contains column labels and rows 2 through 20 contain records, grouping rows 2:20 leaves row 1 visible when the records are collapsed. If row 2 says “North Region” and rows 3:10 contain its transactions, group rows 3:10 to retain the regional heading.
Group Detail Rows Below a Header
In Excel for Microsoft 365 on Windows, use this process for a straightforward outline:
- Arrange the worksheet so the heading or label row is directly above the detail rows you want to hide together.
- Select the detail rows by clicking and dragging their row numbers. For example, select row numbers 3 through 10, not row 2 if it contains the section title.
- Open the Data tab and, in the Outline group, choose Group. If Excel asks whether to group Rows or Columns, choose Rows.
- Look for the outline bracket and the minus button beside the grouped rows. Click the minus button to collapse the details; click the plus button to show them again.
You can also select a cell in each row range rather than clicking row numbers, but selecting entire rows makes the intended range easier to inspect. The Windows shortcut for grouping is Alt+Shift+Right Arrow. On a Mac, the equivalent is Option+Shift+Right Arrow. Shortcuts can be affected by keyboard layout or system settings, so use the Data tab if the combination does not work.
Grouping does not delete records, alter their values, or calculate a total. It changes the outline state of the rows. If you need a total or a label, enter it in an ungrouped row yourself, or use Excel’s Subtotal feature where appropriate.
Keep a Summary Row Above the Details
A summary row is a separate worksheet row, not a special kind of group heading. To keep one at the top of a section, place it immediately above the detail rows and exclude it when you select rows to group. For instance, put “North Region Total” in row 3 and the transactions in rows 4:11, then group rows 4:11. The total row remains visible when the detail is hidden.
If you use Excel’s Subtotal command to insert subtotal rows, its outline setting controls whether summary rows appear above or below detail. On Windows, open Data, then click the small dialog box launcher in the Outline group to open Settings. Clear Summary rows below detail to place generated summary rows above their detail. The setting changes their placement; it does not create a heading for a manually grouped range or automatically turn an existing label into a subtotal.
When a summary row contains a calculated total, check that its calculation covers the intended records and that the summary row itself is outside the detail group. A visible heading with an incorrect total can be more misleading than no total. Also note that the Subtotal command is not available for a normal Excel table; convert a table to a range first if you specifically need that command, or add totals by another method.
A Practical Example: Grouping by Department
Suppose a worksheet has department names in column A and individual expense records in columns B through D. You want one visible heading per department and the ability to hide its transactions. A clear layout might be:
- Row 1: column labels such as Department, Date, Description, and Amount.
- Row 2: a department heading or summary for Sales.
- Rows 3–8: Sales detail records.
- Row 9: a department heading or summary for Support.
- Rows 10–14: Support detail records.
Group rows 3:8 and then rows 10:14 separately. Do not include rows 2 or 9 if those are the headings you want to keep visible, and do not include row 1 if it contains column labels. Excel will show an outline control for each group. When both departments are collapsed, the headings remain in view, making it easier to scan the sheet without losing the department context.
This layout works best when each group’s rows are together. If records for one department are scattered throughout the sheet, sort or reorganize the data first if doing so is appropriate. Grouping separated blocks individually is possible, but it is harder to maintain and can make the outline controls confusing.
Collapse, Expand, and Use Outline Levels
Each group has a minus or plus control next to the row numbers. A minus sign means the rows are currently shown; click it to hide the group. A plus sign means the rows are collapsed; click it to expand them. The visible outline bracket indicates which rows belong to that group.
When a sheet has several groups, numbered outline buttons—often 1, 2, and 3—appear near the top-left of the worksheet, above the row numbers. Clicking a level displays that level of detail across the outline. A lower level shows a more summarized view; a higher level reveals more grouped rows. The exact number of levels depends on the outline’s structure.
These controls are useful for reviewing large worksheets, but they do not protect hidden information. Anyone with access to the workbook may be able to expand the rows. Use worksheet protection or access controls for security requirements; collapsing a group is only a display choice.
Build Nested Groups for More Detail
You can create nested outlines when one broad section contains smaller subgroups. For example, a yearly report might have a group for each month, with another group for the daily rows within each month. To make the hierarchy understandable, keep month headings outside their daily-detail groups and keep the year-level summary outside the monthly groups.
When creating nested groups manually, select the smallest detail ranges first, then group the larger ranges around them. Review the outline-level buttons after each step. If the hierarchy is not what you intended, use Data > Ungroup for the relevant selection and rebuild the levels. Avoid grouping an entire range that includes a heading you need visible at a more detailed level.
Nested grouping is most useful when the sheet has a consistent structure. A long, irregular range with headings mixed among records may be difficult to outline reliably. In that case, consider adding a clear heading row for each section and grouping only the rows beneath it.
Common Problems and How to Fix Them
- The heading disappears when you collapse. It was probably included in the selected group. Expand the group, select only the detail rows, and group that smaller range.
- No plus or minus control appears. Check that the rows were grouped, and look beside the row numbers for the outline bracket. If outline symbols are hidden, open File > Options > Advanced and check the display settings for the worksheet’s outline symbols.
- Excel groups columns instead of rows. If prompted to choose, select Rows. When selecting a range of cells, Excel may infer the direction from the selection; choosing entire row numbers helps make your intention clear.
- Rows are hidden but there is no useful heading. Grouping only hides rows. Add a label or summary in a separate row above the group, then keep that row out of the group.
- The outline is cluttered or incorrect. Select the affected rows and use Data > Ungroup. To remove every outline level from the worksheet, use Data > Ungroup > Clear Outline. Clearing an outline removes grouping controls, but it does not delete the worksheet’s data.
Do not confuse hiding rows manually with grouping. The Hide command hides rows without creating a collapsible outline hierarchy. Group is generally the better choice when you want a reusable expand-and-collapse control.
Excel for Mac and Excel for the Web
In Excel for Mac, select the detail rows and use the Data tab’s Group command; the Mac shortcut is Option+Shift+Right Arrow. The exact ribbon arrangement can vary slightly by Excel release, but the essential rule is the same: exclude the heading row from the selected group. To reverse the operation, use the Ungroup command on the Data tab or Option+Shift+Left Arrow.
Excel for the web has a more limited interface than the Windows desktop app, and available outline controls can differ as Microsoft updates the service. If you cannot create, adjust, or clear the outline you need in a browser, open the workbook in the desktop app and use Data > Group. Existing collapsed rows may also make it appear that data is missing; check for outline buttons or hidden rows before assuming records were removed.
Frequently Asked Questions
Can I keep the column headings visible while grouping rows?
Yes. Leave the column-heading row outside the group and select only the data rows below it. Collapsing the group hides the selected data, not the ungrouped heading.
Does grouping automatically add a header or total?
No. Group creates outline controls for showing and hiding selected rows. Add a heading or total in its own row and leave it outside the group if it must remain visible.
How do I put Excel subtotal rows above the detail?
On Windows, open Data > the Outline dialog box launcher > Settings, and clear Summary rows below detail before using the Subtotal command. This controls generated subtotal placement, not the position of a manually grouped heading.
Can I group rows without hiding the header when I print?
Yes. Keep the header outside the group, then expand or collapse the detail to choose what is displayed before printing. Check Print Preview, because collapsed rows are hidden from the worksheet view and generally do not appear in the printed output.
How do I remove a row group without deleting data?
Select the grouped rows and choose Data > Ungroup. To remove all outline groups on the sheet, choose Data > Ungroup > Clear Outline. These commands remove the outline structure, not the row contents.
Related
- Excel Data Validation Character Limits and Messages
- Excel Data Validation: Create a Filtered Dropdown List
- Excel Data Table Image: Convert Pictures to Cells
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Shortcuts List: Essential Keys for Faster WorkFor Excel for Microsoft 365 on Windows, the most useful shortcuts include Ctrl+C and Ctrl+V to copy and…
- How to Add a Timestamp in Google Sheets AutomaticallyTo add a fixed timestamp in Google Sheets, select a cell and press Ctrl+Alt+Shift+; on Windows or ChromeOS;…
- Calculate Age in Excel From Two Dates: Exact YearsTo calculate someone’s age in completed years from a birth date and a second date, enter the birth…
- Change Outlook Tasks Date Format in Grid ViewIn classic Outlook for Microsoft 365 on Windows, change a task grid’s date display through View > View…
- Default Template in Word: How to Set It UpTo make new blank documents start with your preferred formatting, edit Word’s Normal.dotm template, save it, then open…
- COUNTIF Text in Google Sheets: Examples and TipsTo count text in Google Sheets, use COUNTIF with the cells to check and the text criterion, such…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.