How to Group Cells in Excel (6 Different Ways)

6 Different Ways to Group Cells in Excel

To group cells in Excel, we are going to use the following dataset. It contains some products in column B, the name of the brand of those products in column C, sales in January, February, and March in columns D, E, and F, and the total sales of each product in column G. Suppose we don’t need the individual sales per month or brand. So, we can group them.

Method 1 – Grouping Cells Using Excel Group Feature

Grouping Cells Using Excel Group Feature

Grouping Cells Using Excel Group Feature

Method 2 – Apply Subtotal Command to Group Cells

Steps:

Grouping Cells Using Excel Group Feature

Grouping Cells Using Excel Group Feature

Method 3 – Keyboard Shortcuts to Group Cells in Excel

Steps:

Keyboard Shortcuts to Group Cells in Excel

Method 4 – Use the Auto Outline Option to Group Cells with the Same Value

Steps:

Method 5 – Apply Pivot Table to Group Cells with the Same Value

Steps:

Apply Pivot Table to Group Cells with the Same Value

Method 6 – Use VBA to Group Cells

Steps:

VBA Code:

Sub Group_Cells() Range("C5:C8").EntireRow.Group Range("C9:C12").EntireRow.Group Range("C13:C15").EntireRow.Group Range("D5:F15").EntireColumn.Group End Sub Sub Display_Levels() ActiveSheet.Outline.ShowLevels RowLevels:=1, ColumnLevels:=2 End Sub

Collapse & Expand Cells after Grouping

To collapse the grouped cells, on the left, click the minus (‘’) icon or click on the numbers. The exterior numbers will collapse the cells.

To expand the grouped cells, use the plus (‘+’) sign and this will widen the collapsed collection of cells, or click on the numbers close to the headers. The inner numbers will expand the cells.

Ungroup Cells in Excel

Steps:

You can Ungroup the cells by using the keyboard shortcut Shift + Alt + Left Arrow.

Download Practice Workbook

You can download the workbook and practice grouping cells.

Group Cells.xlsm

Group Cells in Excel: Knowledge Hub