Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Collapse Cells in Excel: Step-by-Step Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To collapse cells in Excel, you do not actually merge them into one cell — you hide the rows or columns around the content you want to keep, or you group them so they can be folded away with a single click. The fastest route is to select the rows or columns, open the Data tab, choose Group, and then click the minus sign that appears. If you only need to hide a few rows, select them, right-click the row headers, and choose Hide. Either way, the data stays intact and can be brought back at any time.

This guide covers the two real methods — grouping with an outline and simply hiding rows or columns — plus how to collapse grouped data in a PivotTable and how to undo any of it. Menu labels can differ slightly by Excel version, platform and region, so if a label does not match exactly, look for the closest equivalent on the same tab.

What You'll Need

  • Excel for Microsoft 365, Excel 2021, Excel 2019, or Excel for Mac — the Data tab and Group feature exist in all of them.
  • A worksheet with data laid out in rows or columns, ideally with a header row so you can tell what you are collapsing.
  • No special permissions are required for grouping or hiding on a local file. If the workbook is shared and protected, you may need the sheet unprotected first.

Step-by-Step

Method 1: Group rows or columns so they collapse with a click

  1. Open your workbook and click the sheet tab that contains the data.
  2. Select the rows or columns you want to collapse. Click the first row number, hold Shift, and click the last row number. To select columns, do the same with the column letters.
  3. Go to the Data tab on the ribbon.
  4. In the Outline group, click Group. If you selected entire rows or columns, Excel groups them immediately. If you selected individual cells, a small dialog appears — choose Rows or Columns and click OK.
  5. A grey outline bar appears above the column letters or to the left of the row numbers, with a minus (–) button at the end of the grouped range.
  6. Click the minus button to collapse the group. The rows or columns disappear from view and the button becomes a plus (+).
  7. Click the plus button to expand the group again. The data was never deleted — only hidden.

Method 2: Hide rows or columns directly

  1. Select the rows or columns you want to collapse by dragging across their headers.
  2. Right-click any selected row number or column letter.
  3. Choose Hide from the context menu. The rows or columns vanish, and the remaining headers close up.
  4. To bring them back, select the rows or columns on both sides of the hidden range — for example, select row 4 and row 8 if rows 5 to 7 are hidden — then right-click and choose Unhide.

Method 3: Collapse grouped items in a PivotTable

  1. Click anywhere inside the PivotTable.
  2. Look for the small minus (–) buttons next to row or column labels. These appear when the PivotTable has more than one row or column field.
  3. Click a minus button to collapse that level and show only the subtotal or top-level label. Click the plus (+) to expand it again.
  4. To collapse everything at once, go to the PivotTable Analyze tab and use the Collapse Field or Expand Field buttons in the Active Field group.

Common Mistakes

  • Merging cells instead of collapsing them. Merge & Center combines cells into one and destroys the individual values except the top-left one. If you want to fold data away and keep it, use Group or Hide, not Merge.
  • Selecting cells instead of whole rows or columns. Grouping a partial selection can produce odd outline levels. Select the full row or column headers when you can.
  • Forgetting that hidden rows still calculate. Formulas, SUM totals and charts still include hidden data. If you need totals to ignore collapsed rows, use SUBTOTAL with function number 109, or filter instead of hiding.
  • Hiding the wrong range. If your selection skips a row, Unhide later becomes fiddly because you must select across the gap.
  • Grouping inside an existing group. Excel supports up to eight outline levels, but nesting too deeply makes the outline bar confusing. Keep it to two or three levels.

Tips

  • Put your summary or total row outside the grouped range so it stays visible when the group collapses.
  • Use the outline buttons at the top-left of the sheet — the numbered 1, 2, 3 buttons — to collapse or expand all groups at a given level in one click.
  • To remove grouping entirely, select the grouped rows or columns, go to Data > Ungroup, and click Ungroup again if Excel asks. The data stays; only the outline bar disappears.
  • Keyboard shortcut: select rows, then press Alt+Shift+Right Arrow to group and Alt+Shift+Left Arrow to ungroup (Windows). On Mac, use Command+Shift+K to group and Command+Shift+J to ungroup.
  • Freeze the header row first with View > Freeze Panes so you can still see column labels after collapsing rows.

Troubleshooting

  • The Group button is greyed out. The sheet is probably protected. Go to Review > Unprotect Sheet. If you do not know the password, ask the file owner — do not try to bypass it.
  • No outline bar appears after grouping. Check File > Options > Advanced > Display options for this worksheet and make sure Show outline symbols if an outline is applied is ticked.
  • You cannot find the hidden rows to unhide. Select the entire sheet with Ctrl+A (or click the corner box above row 1), then right-click a row header and choose Unhide.
  • Grouping produces an error about overlapping ranges. You have selected a range that cuts across an existing group. Ungroup the existing outline first, then regroup cleanly.
  • PivotTable minus buttons are missing. Click inside the PivotTable, go to the Design tab, and check that Subtotals and Grand Totals are enabled — collapse buttons need those levels to exist.

Frequently Asked Questions

Does collapsing cells delete the data?

No. Grouping and hiding only change what is displayed. Every value remains in the workbook and reappears when you expand or unhide.

Can I collapse cells in Excel Online?

Grouping and hiding rows or columns work in Excel for the web, though the outline buttons and some PivotTable expand/collapse controls may be limited compared with the desktop app. For full control, open the file in desktop Excel.

What is the difference between Group and Hide?

Hide simply removes rows or columns from view. Group adds an outline bar with plus and minus buttons, so you can collapse and expand repeatedly and manage several sections at once.

Why do my totals change when I collapse rows?

They should not — hidden rows still count in SUM and AVERAGE. If you want totals to ignore collapsed rows, replace SUM with SUBTOTAL(109, range).

Can I collapse columns the same way as rows?

Yes. Select the column letters, then use Data > Group or right-click > Hide. The outline bar appears above the column headers.

How do I remove all grouping at once?

Select the whole sheet with Ctrl+A, then go to Data > Ungroup > Clear Outline. This removes every outline level without touching your data.