Grouping lines in Excel lets you collapse and expand sections of your spreadsheet

Grouping in Excel means bundling rows or columns together so you can hide or show them all at once with a single click. When you group lines, Excel adds a small minus sign (called a collapse button) next to the grouped section. Click that button and the entire group disappears; click it again and the group reappears. This is useful when your spreadsheet has many rows or columns but you only need to see certain parts at a time.

Grouping is different from sorting or filtering. It does not rearrange your data or hide rows based on their content — it straightforward lets you control visibility of sections you choose. The grouped data stays in its original order and location.

Key Takeaways

  • Select the rows or columns you want to group, then use the Data menu to create the group.
  • Excel adds a collapse button (minus sign) next to grouped sections that you click to hide or show them.
  • You can create multiple levels of grouping so that collapsing one group hides smaller groups inside it.
  • Grouping only affects visibility on your screen — it does not change the data itself or how it prints unless you tell Excel to print only visible cells.

How to group rows in Excel

Start by selecting all the rows you want to group together. Click on the row number of the first row, then hold Shift and click on the row number of the last row you want to include. The entire rows will highlight in blue. If the rows are not next to each other, hold Ctrl and click each row number individually instead.

Once your rows are selected, go to the Data menu at the top of the screen. Click it, then look for the word Group in the dropdown menu that appears. Click Group. Excel will when ready add a small box with a minus sign to the left of your selected rows, usually in a new column on the far left of the spreadsheet. That minus sign is your collapse button.

To test it, click the minus sign. Your grouped rows will disappear, and the minus sign will change to a plus sign. Click the plus sign to bring the rows back. You can now hide or show that entire section with a single click instead of manually hiding each row.

How to group columns in Excel

Grouping columns works the same way as grouping rows, but you select columns instead. Click on the column letter of the first column you want to group (for example, column C), then hold Shift and click on the column letter of the last column in your group. All the columns between them will highlight.

Go to the Data menu, click it, and select Group. Excel will add a collapse button above your grouped columns, usually in a new row at the very top of the spreadsheet. Click the minus sign to hide all those columns at once, and click the plus sign to show them again.

This is especially helpful when you have many similar columns — for example, monthly sales data for January through December. You can group all twelve months together, then collapse them to see only the annual total column.

Creating multiple levels of grouping

You can create groups within groups. For example, you might group rows 2–5 together as "Q1 Sales," then group rows 6–9 as "Q2 Sales," then group all rows 2–9 together as "First Half Sales." Excel will show you numbered buttons (usually 1, 2, 3) on the left side of the spreadsheet that let you jump between different levels of detail.

To create nested groups, make your smallest groups first. Select rows 2–5 and group them. Then select rows 6–9 and group them. Finally, select rows 2–9 and group them again. Now you have three levels: click the "1" button to see only the main categories, click "2" to see the quarters, or click "3" to see all individual rows.

This is powerful for large spreadsheets where you want to show different amounts of detail to different people. A manager might look at level 1 to see only annual totals, while a team member might work at level 3 to see every transaction.

Ungrouping rows or columns

If you no longer want a group, you can remove it. Select the grouped rows or columns the same way you selected them to create the group — click the first row or column number, hold Shift, and click the last one. Then go to Data menu and look for Ungroup. Click it, and the collapse button disappears. The rows or columns stay in place; only the grouping is removed.

If you have multiple levels of grouping and want to remove only one level, select just the rows or columns in that specific group before clicking Ungroup. The other groups will remain intact.

What happens when you print or share a grouped spreadsheet

When you print a spreadsheet with groups, Excel normally prints all rows and columns, whether they are collapsed or not. If you have hidden a group by clicking the minus sign, that group will still print. To print only the visible (non-hidden) cells, go to File, then Print, and look for an option that says Print Active Sheets or similar. Some versions of Excel have a checkbox for "Print only visible cells" — check that box if you see it.

When you share the spreadsheet with someone else, they will see the collapse and expand buttons, but they will also see all your data unless you have actually hidden rows or columns separately. Grouping alone does not prevent someone from expanding the group and seeing everything. If you need to truly hide sensitive data, use Excel's protection features instead.

Frequently Asked Questions

Can I group non-adjacent rows or columns?

No. Grouping only works on rows or columns that are next to each other. If you need to group rows 2–5 and rows 10–15 separately, you must create two different groups. You cannot select rows 2–5 and 10–15 at the same time and make one group.

What if the Group button is grayed out in the Data menu?

This usually means you have not selected any rows or columns, or you have selected only one row or column. Excel requires at least two rows or columns to create a group. Make sure you have selected multiple rows or columns before clicking Data.

Does grouping change my data or formulas?

No. Grouping only controls what you see on screen. Your actual data, formulas, and calculations remain exactly the same. If a formula refers to a hidden row, it still uses that row's value even though you cannot see it.

Can I delete a grouped row without ungrouping first?

Yes. You can right-click on a grouped row and select Delete, and Excel will remove that row and adjust the group automatically. You do not need to ungroup first.

How do I remove all groups at once?

Select all cells in your spreadsheet by pressing Ctrl+A, then go to Data and click Ungroup. A dialog box will appear asking if you want to remove all outline levels. Click OK, and all groups will be removed at once.