ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • About
  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Productivity
  3. How to Group Rows and Columns in Excel (Outline)

How to Group Rows and Columns in Excel (Outline)

By ExcelReady Team·Updated November 2, 2026·6 min read

The short answer

To group rows in Excel, select the whole rows you want to fold away, then go to Data > Group, or press Shift+Alt+Right Arrow on Windows (⌘⇧K on a Mac). Excel adds a minus button beside the rows. Click it to collapse the group and the plus button to expand it again. Columns group the same way.

Key takeaways

  • Select whole rows or columns first, then use Data > Group or Shift+Alt+Right Arrow (Mac: ⌘⇧K).
  • The minus and plus buttons collapse and expand one group. The level numbers at the top left collapse every group at once.
  • Data > Subtotal inserts SUBTOTAL rows and builds the outline in one step, but sort the data first.
  • Collapsed rows are only hidden. SUM still counts them, and SUBTOTAL ignores other SUBTOTAL rows, so grand totals don't double count.
On this page+
  1. How to group rows in Excel
  2. How to group columns
  3. How do outline levels work?
  4. How to group rows automatically
  5. Do collapsed rows count in totals?
  6. Group, hide or freeze?
  7. How to ungroup rows
  8. Practise it

To group rows in Excel, select the rows, choose Data > Group, and Excel adds a small minus button that folds them away. Grouping (Excel also calls it an outline) is the tidy way to hide detail in long reports: readers see the totals first and open the detail only when they need it. This guide covers the shortcuts on Windows and Mac, outline levels, automatic grouping and how to keep your totals right.

How to group rows in Excel#

Grouping takes three steps, and the only thing to get right is the selection.

  1. Select the whole rows you want to fold away. Click the first row number and drag down, or click a cell and press Shift+Space to select its row, then Shift+Down Arrow to extend. Don't include the total row: it should stay visible.
  2. Group them. Go to Data > Group (in the Outline area), or press Shift+Alt+Right Arrow on Windows or ⌘⇧K on a Mac.
  3. Collapse the group. Click the minus button that appears in the left margin. It turns into a plus button. Click that to expand the rows again.

If you selected cells instead of whole rows, Excel asks whether you mean Rows or Columns. Pick Rows and click OK. Faster selection habits make this smoother; the selection shortcuts lesson drills Shift+Space, Ctrl+Space and extending with Shift.

Here is a typical sales report before grouping:

RowABC
1RegionMonthSales
2NorthJan1,200
3NorthFeb900
4North total2,100
5SouthJan700
6SouthFeb1,100
7South total1,800
8Grand total3,900

Group rows 2 to 3, then rows 5 to 6. Collapse both and the report shows only the two region totals and the grand total.

How to group columns#

Columns group exactly like rows. Select whole columns (click the letters, or press Ctrl+Space on a cell), then use Data > Group or the same shortcut. The buttons appear above the column letters instead of beside the row numbers.

A common use is a budget with twelve month columns and a yearly total. Group January to December and collapse them, and the sheet shows the yearly figure alone. Grouping doesn't move or delete anything, so formulas that point at the months keep working. The rows and columns lesson covers selecting, inserting and resizing them.

How do outline levels work?#

Outline levels let you collapse every group at once. When you group, Excel shows small numbered buttons at the top left of the sheet: 1, 2 and so on.

  • Level 1 shows only the outermost summary, such as the grand total.
  • Level 2 shows the next layer, such as the region totals.
  • The highest number shows every row.

You can put groups inside groups, up to eight levels deep. For example, group rows 2 to 7 first (both regions), then group 2 to 3 and 5 to 6 inside it. Now level 1 shows just the grand total, level 2 adds the region totals, and level 3 shows every month.

To hide the buttons without removing the groups, press Ctrl+8 on Windows. Press it again to bring them back.

How to group rows automatically#

Excel can build the groups for you in two ways.

Auto Outline#

If your sheet already has total rows with formulas such as =SUM(C2:C3), go to Data > Group > Auto Outline. Excel looks for rows that add up the rows above them and groups the detail. It works best when every total is a formula directly below its detail rows.

Data > Subtotal#

The Subtotal command inserts the total rows and groups them in one step. Sort the data by the column you want to group on (Region here), then go to Data > Subtotal, choose "At each change in: Region", "Use function: Sum" and tick Sales. Excel adds a total row under each region and a grand total at the bottom, all written as SUBTOTAL formulas, with the outline already built.

Subtotal needs the data sorted. If North rows are scattered, you get several separate North totals. It also doesn't work inside an Excel table, so convert the table to a range first (Table Design > Convert to Range).

Do collapsed rows count in totals?#

Yes. Collapsing a group only hides the rows, and =SUM(C2:C7) still adds every row, hidden or not. That is usually what you want for a grand total.

The real risk is double counting. In the report above, =SUM(C2:C7) returns 7,800, because it adds the months and the two region totals. Use SUBTOTAL instead:

Excel formula
=SUBTOTAL(9,C2:C7)

This returns 3,900. Function number 9 means sum, and SUBTOTAL skips any cell in its range that holds another SUBTOTAL formula. So write the region totals as =SUBTOTAL(9,C2:C3) and =SUBTOTAL(9,C5:C6), and the grand total can cover the whole column safely.

If you want a total of only the rows you can still see when groups are collapsed, use 109 instead of 9. Collapsed rows count as hidden by hand, and the 100-series numbers leave those out. The SUBTOTAL function guide lists every function number, and the article on SUBTOTAL and filtered rows explains 9 vs 109 with examples.

Group, hide or freeze?#

Grouping, hiding and freezing all change what you see, but they solve different problems.

ToolWhat it doesBest for
GroupFolds rows away behind a plus buttonReports with detail and totals
HideHides rows with no visible buttonHelper columns nobody needs
Freeze PanesKeeps headers on screen while you scrollLong lists

Grouping is the friendlier choice when other people read the file, because the plus buttons show that something is folded away. Hidden rows are easy to miss; see how to hide and unhide rows and columns when you need that instead. To keep headers visible as you scroll a long grouped report, combine it with Freeze Panes.

In a PivotTable, Group means something else: it combines items, such as dates into months or quarters. You right-click an item and choose Group. The PivotTable grouping lesson practises that.

How to ungroup rows#

To remove one group, select its rows and choose Data > Ungroup, or press Shift+Alt+Left Arrow on Windows (⌘⇧J on a Mac). To remove every group on the sheet, choose Data > Ungroup > Clear Outline. Your data stays where it is, and any collapsed rows are shown again.

If you later insert rows inside a group, they join that group automatically. Rows inserted just below a group's last row may not, so check the bracket in the margin. The guide to inserting multiple rows shows the fastest ways to add them.

Practise it#

Try the exercise on this page: it is the grand total from the report above, and SUM would give the wrong answer. Then practise working with rows and columns in a live spreadsheet, where you select, insert and resize them and get instant feedback on each step.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Rows 4 and 7 already hold SUBTOTAL formulas for each region. In C8, write a grand total with SUBTOTAL over the whole column C2:C7, so the two region subtotals are not counted twice.

fx
ABCD
1
Region
Month
Sales
2
North
Jan
1200
3
North
Feb
900
4
North total
2100
5
South
Jan
700
6
South
Feb
1100
7
South total
1800
8
Grand total
9
10
11

Tip: Function number 9 means sum. SUBTOTAL skips any cell in its range that is itself a SUBTOTAL.

Practise this in a lesson

LessonFreeCells, rows and columnsLearn how every cell gets its name, then find cells, type into them and select ranges.LessonFreeSelect ranges with ShiftHold Shift with the arrow keys to select as you go, then grab whole columns, rows and tables in one keystroke.LessonPivot tables 2Go further with PivotTables: nest two row fields with subtotals, add a report filter, show values as a % of the grand total, update the source when new rows arrive, and know when SUMIFS is the better tool.Function guideSUBTOTALTotal filtered lists and grouped data without double counting using SUBTOTAL. Function codes 9, 109 and more, plus a live exercise.

Frequently asked questions

What is the shortcut to group rows in Excel?

+

On Windows, select the rows and press Shift+Alt+Right Arrow. Shift+Alt+Left Arrow ungroups them. On a Mac, use ⌘⇧K to group and ⌘⇧J to ungroup.

Why is Group greyed out in Excel?

+

Usually the sheet is protected, or you are still editing a cell. Press Esc to leave the cell, or unprotect the sheet, then try Data > Group again.

What is the difference between grouping and hiding rows?

+

Both hide rows, but grouping adds plus and minus buttons in the margin, so anyone can see that rows are folded away and open them with one click. Hidden rows only show as a skipped row number.

How many levels of grouping does Excel allow?

+

Excel allows up to eight levels of groups inside groups. The level buttons at the top left of the sheet let you collapse or expand to any level.

How do I remove all groups at once?

+

Go to Data > Ungroup > Clear Outline. The rows stay where they are and any collapsed rows are shown again.

Sources

  • SUBTOTAL function - Microsoft Support
  • Keyboard shortcuts in Excel - Microsoft Support

Written and checked by the ExcelReady Team. First published November 2, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. How to group rows in Excel
  2. How to group columns
  3. How do outline levels work?
  4. How to group rows automatically
  5. Do collapsed rows count in totals?
  6. Group, hide or freeze?
  7. How to ungroup rows
  8. Practise it

Keep reading

Productivity· 5 min read

Hide and Unhide Rows and Columns in Excel

To unhide rows in Excel, select the rows above and below the hidden ones, right-click a row number and choose Unhide. To unhide everything, select the whole sheet first. To hide rows, select them and press Ctrl+9 or right-click and choose Hide. Hidden rows still count in SUM; use SUBTOTAL(109,...) to total only the visible ones.

Data tools· 5 min read

SUBTOTAL in Excel: Totals That Ignore Filtered Rows

SUBTOTAL calculates a total that skips rows hidden by a filter: =SUBTOTAL(109,D2:D11) adds only the visible amounts, while SUM adds every row. The first argument picks the calculation: 9 or 109 sums, 1 or 101 averages, 3 or 103 counts non-empty cells. The 100s also skip rows you hid by hand.

Basics· 6 min read

Freeze Panes in Excel: Keep Headers in View

To freeze panes in Excel, click the cell just below the rows and to the right of the columns you want to keep in view, then go to View > Freeze Panes > Freeze Panes. To keep only the header row, choose Freeze Top Row. To undo it, choose View > Freeze Panes > Unfreeze Panes.

More on productivity

  • How to Import a CSV File Into Excel Without Breaking It
  • Shortcut to Insert Today's Date and Time in Excel
  • How to Insert Multiple Rows in Excel at Once
  • Excel Keyboard Shortcuts Cheat Sheet for Windows and Mac
  • Excel Macros for Beginners: Record Your First Macro
  • Named Ranges in Excel: Clearer Formulas
All productivity articles →

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free