Grouping lines in Excel collapses related rows or columns so you can hide them with one click, then expand them again when you need to see the detail

Excel's grouping feature lets you organize your spreadsheet so viewers can focus on summary data first, then drill down into the details. When you group rows or columns, Excel adds a small minus sign (–) next to the group. Click it to hide those lines; click the plus sign (+) to show them again. This is especially useful in financial statements, project timelines, or any sheet where you have subtotals or categories that contain multiple supporting rows.

Grouping works best when your data is already organized — all the rows or columns that belong together should sit next to each other. Excel does not automatically detect which lines go together; you select them first, then tell Excel to group them.

Key Takeaways

  • Select the rows or columns you want to group by clicking the row number or column letter on the left or top edge of the spreadsheet.
  • Go to the Data menu, click Group, and choose whether to group rows or columns.
  • Excel adds a minus sign next to the group that collapses the selection; click it again to expand.
  • You can create nested groups (groups within groups) by grouping different sets of rows and then grouping those groups together.
  • To remove a group, select it and go to Data > Ungroup.

How to select and group rows

Start by clicking the row number of the first row you want to group. Hold Shift and click the row number of the last row in that group. All rows between them will turn blue, showing they are selected. If the rows you want to group are not next to each other, hold Ctrl (or Command on Mac) and click each row number individually.

Once your rows are selected, go to the Data menu at the top of the screen. Click the word "Group" — it usually appears near the middle of the menu. A small dialog box will pop up asking whether you want to group rows or columns. Since you selected rows, "Rows" should already be highlighted. Click OK. Excel will 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.

Click the minus sign to hide those rows. The minus sign becomes a plus sign. Click the plus sign to show them again. The rows themselves are not deleted — they are just hidden from view.

How to select and group columns

Grouping columns works the same way as grouping rows, except you click column letters instead of row numbers. Click the letter of the first column you want to group, hold Shift, and click the letter of the last column. All columns between them will highlight in blue.

Go to Data > Group, make sure "Columns" is selected in the dialog box, and click OK. Excel adds a control box above your columns with a minus sign. Click it to hide the columns; click the plus sign to show them again. This is useful when you have monthly data (12 columns) and want to hide the individual months to show only quarterly totals.

Creating nested groups (groups within groups)

You can group rows, then group some of those groups together to create a second level of organization. For example, you might have rows 2–5 grouped as "Q1 Sales", rows 6–9 grouped as "Q2 Sales", and then group all of rows 2–9 together as "2024 Sales".

To do this, first create your smallest groups (Q1, Q2, etc.) using the steps above. Then select all the rows that contain those groups — including the group control boxes themselves — and group them again. Excel will add a second set of control boxes, usually with numbers (1, 2, 3) showing how many levels of grouping exist. Click the number to jump to that level of detail: click 1 to see only the top-level summary, click 2 to see the first level of groups, click 3 to see all rows.

You can create up to eight levels of nested groups in a single spreadsheet, though most sheets only need two or three.

Removing groups

To remove a group, click any row or column number inside that group. Go to Data > Ungroup. A dialog box will ask whether you want to ungroup rows or columns. Click OK. The group control box disappears, and all rows or columns become visible again. The data itself is not changed — only the grouping is removed.

If you have nested groups and want to remove only the outer group (keeping the inner groups intact), select a row from the outer group and ungroup. If you want to remove all groups at once, select all cells in your spreadsheet (Ctrl+A or Command+A), then go to Data > Ungroup.

Common mistakes and how to fix them

The most common mistake is trying to group rows that are not next to each other. Excel will not let you group non-adjacent rows in a single action. If your data is scattered, either move the rows so they sit together, or create separate groups for each section.

Another mistake is grouping before your data is organized. If you have a summary row at the bottom of a group, make sure it is inside the group, not outside it. For example, if rows 2–5 contain detail and row 6 contains the subtotal, group rows 2–6 together, not 2–5.

If the group control boxes are not showing up, check that you actually clicked OK in the Group dialog. Sometimes the dialog closes without applying the group if you accidentally click elsewhere. Try selecting the rows again and repeating the steps.

When grouping is useful

Grouping is most helpful in financial reports where you have line items and subtotals. For instance, a budget spreadsheet might have rows for individual expenses (office supplies, postage, travel) grouped under "Operating Costs", then other groups for "Salaries" and "Equipment". A manager can collapse all groups to see only the category totals, then expand "Salaries" to see the breakdown.

Grouping also works well for project timelines where you have tasks grouped by phase, or sales data grouped by region or product line. Any time your spreadsheet has a natural hierarchy — detail rows that belong under a category — grouping makes it easier to navigate.

Frequently Asked Questions

Can I group rows and columns at the same time?

No, you must group rows and columns separately. Select your rows, group them, then select your columns and group those. You can have grouped rows and grouped columns in the same spreadsheet, but each group is independent.

What happens to my groups if I add a new row in the middle?

If you insert a new row inside a grouped section, it automatically becomes part of that group. If you insert a row outside the group, it stays outside. If you are not sure where the new row ended up, click the minus sign to collapse the group and see what is hidden.

Can I print a spreadsheet with groups collapsed?

Yes. Collapse the groups the way you want them to appear, then print. Excel will print only the visible rows and columns. The hidden rows and columns will not appear on the printed page.

Is there a keyboard shortcut for grouping?

There is no single keyboard shortcut that works in all versions of Excel, but you can use Alt+D (then G on Windows) to open the Data menu and access Group. On Mac, the menu path is the same: Data > Group. Some users create custom shortcuts through Excel's Options menu.

What is the difference between grouping and filtering?

Grouping hides rows or columns but keeps them in the spreadsheet and lets you expand them with one click. Filtering removes rows from view based on criteria you set, and you have to change the filter to see different rows. Grouping is better for exploring a fixed structure; filtering is better for finding specific data.