How to Group Rows in Excel using the Expand or Collapse features – 5 Methods

 

This is the sample dataset.

 


Method 1 – Using a Shortcut Key to Group Rows in Excel with the Expand or Collapse feature

To group data for Canada:

  • Select the rows that contain Canada.
  • Press Shift+Alt+Right Arrow Key.

Use Shortcut Key to Group Rows in Excel with Expand Or Collapse

Rows are grouped with the expand or collapse option.

Use Shortcut Key to Group Rows in Excel with Expand Or Collapse

Apply the same procedure for the other regions.

Use Shortcut Key to Group Rows in Excel with Expand Or Collapse

Read More: How to Group Rows in Excel


Method 2 – Use the Group Command to Group Rows in Excel with the Expand or Collapse feature

 

  • Select the rows containing Canada.
  • Click: Data > Outline > Group

Use Group Command to Group Rows in Excel with Expand Or Collapse

Follow the same steps for the other regions.

Use Group Command to Group Rows in Excel with Expand Or Collapse

Read More: How to Group Rows by Cell Value in Excel


Method 3 – Use the Auto Outline Command to Group Rows in Excel with the Expand or Collapse feature

  • Select any data in the dataset.
  • Click: Data > Outline > Group > Auto Outline

Use Auto Outline Command to Group Rows in Excel with Expand Or Collapse

Groups were created for different regions:

Use Auto Outline Command to Group Rows in Excel with Expand Or Collapse


Method 4 – Create Nested Groups in Excel with the Expand or Collapse feature

A new column was added to show the selling items.

Group the printer items within Canada.

  • Select the rows that contain Printer within the Canada group.

Press Shift+Alt+Right Arrow Key or click Data > Outline > Group.

Create Nested Groups in Excel with Expand Or Collapse

The nested group or subgroup is created.

Create Nested Groups in Excel with Expand Or Collapse

Read More: How to Group Rows in Excel by Name


Method 5 – Create a Group with Automatic Subtotals in Excel

  • Click any data in the dataset.
  • Click: Data > Outline > Subtotal.

Create Group with Automatic Subtotals in Excel

  • Select Region in At each change in.
  • Choose Sum in Use function.
  • Check Sales and Profit in Add subtotal to.
  • Click OK.

Create Group with Automatic Subtotals in Excel

Groups and subtotals were created based on regions.

Create Group with Automatic Subtotals in Excel


How to Expand or Collapse Rows in Excel

To collapse groups, click the Minus sign at the lower part of each group.

Expand Or Collapse Rows in Excel

You can  also do it using a command:

  • Select any data in the group you want to collapse.
  • Click: Data > Outline > Hide Detail.

Expand Or Collapse Rows in Excel

The group with Canada region is collapsed and is showing a plus sign.

Expand Or Collapse Rows in Excel

To expand the group, click the plus sign.

Expand Or Collapse Rows in Excel

Or click: Data > Outline > Show Detail.

The group is expanded.


Collapse or Expand the Entire Outline 

If your dataset is very large, you can collapse or expand the entire outline at a time.

There are numbers above the expand/collapse option showing the group level.

  • The first level is the regions group .
  • The second level is the items group within a region.

Click 1 and all groups for regions are collapsed.

Collapse Or Expand the Entire Outline to a Certain Level

This is the output.

Collapse Or Expand the Entire Outline to a Certain Level

To expand the entire outline, click 3.

All the groups are expanded.


How to Remove an Outline and Ungroup Rows

  • Select any cell in the dataset and click: Data > Outline > Ungroup > Clear Outline.

Remove Outline and Ungroup Rows

Excel removed the entire outline.

To ungroup it, select the rows in the group and click as follows: Data > Outline > Ungroup.

The rows are ungrouped.

Do it for each group individually.

Read More: How to Group and Ungroup Columns or Rows in Excel


Things to Remember

  • Press the right shortcut key: Shift + ALT + Right Arrow Key.
  • The subtotal command is applied to sorted data.
  • The Auto Outline command will group all the rows above the subtotal row.

Download Practice Workbook

Download the free Excel template.


Related Articles

<< Go Back to Group Cells in Excel | Outline in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Md. Sourov Hossain Mithun
Md. Sourov Hossain Mithun

Md. Sourov Hossain Mithun, an Excel and VBA Content Developer at Softeko's ExcelDemy project, joined in October 2021. Holding a Naval Architecture & Marine Engineering degree from BUET, Mithun showcases expertise during his two-year tenure. With over 200 published articles on Excel topics, he earned a promotion to Team Leader, excelling in leading diverse teams. Mithun's passion extends to Advanced Excel, Excel VBA, Data Analysis, and Python programming, contributing significantly to the innovative and dynamic environment of ExcelDemy... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo