Grouping records in Excel lets you collapse and expand rows or columns to focus on the data you need

Excel's grouping feature organizes your data into collapsible sections. When you group records, Excel adds outline buttons (small plus and minus signs) on the left side of your spreadsheet. Click the minus sign to hide rows, click the plus sign to show them again. This is useful when you have a large dataset and want to focus on summaries, or when you need to hide detail rows while you work on totals.

Grouping works best when your data is already sorted by the column you want to group on. If you have sales data sorted by region, you can group by region. If you have expenses sorted by category, you can group by category. Excel doesn't automatically detect what to group — you tell it which rows belong together.

Key Takeaways

  • Select the rows you want to group, then use the Data menu and choose Group to create collapsible sections.
  • Grouping works on rows or columns, but most commonly you group rows to hide and show detail data beneath summary rows.
  • Your data must be sorted first — Excel groups consecutive rows, not scattered ones.
  • You can create multiple levels of grouping (outline levels 1, 2, 3) to collapse to different degrees of detail.

How to group rows in Excel

Start by sorting your data by the column you want to group on. For example, if you want to group sales by region, sort the entire dataset so all North records are together, all South records are together, and so on. Select the rows you want to hide when the group is collapsed — usually the detail rows beneath a summary row.

With those rows selected, go to the Data tab in the ribbon. Click Group (in the Outline section). A dialog box appears asking whether you want to group rows or columns. Choose Rows and click OK. Excel adds outline buttons on the left margin. The minus sign collapses the group; the plus sign expands it.

If you have multiple groups, repeat this process for each one. You can create up to eight levels of grouping. Excel numbers them 1, 2, 3, and so on at the very left edge. Click a number to collapse all groups to that level of detail at once.

Grouping columns instead of rows

You can also group columns to hide and show related data. This is less common but useful if you have months of data (January through December) and want to collapse them into quarters, or if you have weekly sales figures and want to hide them to see only the monthly total.

Select the columns you want to group by clicking the column header of the first column, then holding Shift and clicking the last column header. Go to Data > Group, choose Columns, and click OK. The outline buttons appear above the columns instead of to the left.

Creating multiple outline levels

If your data has a hierarchy — for example, regions containing districts containing stores — you can create nested groups. Group the smallest unit first (stores), then select and group the next level up (districts), then the next (regions).

Once you have multiple levels, the outline numbers at the left let you jump to any level of detail instantly. Click 1 to see only the highest-level summary. Click 2 to see summaries plus the next level of detail. Click 3 to see everything. This is much faster than clicking individual plus and minus buttons when you have dozens of groups.

Ungrouping records

To remove grouping, select the grouped rows or columns. Go to Data > Ungroup. A dialog appears asking whether to ungroup rows or columns. Choose the correct option and click OK. The outline buttons disappear and all rows or columns become visible again.

If you have multiple levels and want to remove only one level, select just the rows or columns in that level before ungrouping. To remove all grouping at once, select all data and ungroup.

When grouping doesn't work as expected

Grouping fails silently if your data isn't sorted. Excel groups only consecutive rows, so if your data is jumbled, the grouping won't make sense. Always sort first.

If the Group button is grayed out, you may have only one row selected, or you may have selected non-consecutive rows. Select at least two consecutive rows and try again. Also check that you're on the Data tab — the Group button doesn't appear on other tabs.

If you create a group but the outline buttons don't appear, try clicking elsewhere in the spreadsheet and then clicking a cell in the grouped range. Sometimes the buttons are there but not immediately visible until you interact with the sheet.

Alternatives to grouping

If grouping feels complicated for your task, consider using AutoFilter instead. Go to Data > AutoFilter to add dropdown arrows to your headers. Click a dropdown to show or hide rows based on their value. This is simpler than grouping if you just want to hide certain records temporarily.

For very large datasets, a pivot table may be more powerful. Pivot tables automatically organize and summarize data by category, and they let you drill down into detail or collapse to summary with a single click. If you find yourself grouping the same data the same way repeatedly, a pivot table usually saves time.

Frequently Asked Questions

Can I group non-consecutive rows?

No. Excel groups only rows that are next to each other. If your rows aren't consecutive, sort your data first so the rows you want to group are together, then group them.

What's the difference between grouping and filtering?

Grouping hides rows but keeps them in the spreadsheet and includes them in calculations. Filtering removes rows from view and from calculations. Use grouping to organize and collapse related data; use filtering to temporarily hide rows that don't match a condition.

Can I print only the visible (ungrouped) rows?

Yes. When you collapse groups, Excel hides the detail rows. If you print while groups are collapsed, only the visible rows print. This is useful for printing summaries without all the detail.

How many levels of grouping can I create?

Excel supports up to eight outline levels. In practice, most datasets use two or three levels. If you need more than eight, a pivot table is usually a better choice.

If I group data, does it affect my formulas?

No. Grouping is purely visual — it hides and shows rows but doesn't change formulas or calculations. Formulas that reference grouped rows work the same whether the rows are collapsed or expanded.