←Module 5
Lesson · 15 min

Groups and Subtotals

Learn how to organize large datasets using grouping and automatically summarize data with the Subtotal command.

By the end of this lesson you can

  • Group rows and columns into collapsible outlines
  • Apply automatic subtotals to a sorted data set
  • Explain why data must be sorted before subtotalling
  • Remove subtotals and return to a clean data range

Video

Watch the lesson video, then complete the reading and challenge.

Lesson Notes

Read through the key concepts before you try the challenge.

Subtotals require a sort first

On the job

You summarize spending by category at Lakeside Medical Associates.

You run Data > Subtotal on the supply sheet without sorting it first. Excel inserts a subtotal every time the category changes from one row to the next — producing forty-one subtotals across a sheet with four categories.

Your task: Sort by the grouping column first, so each category occupies one contiguous block.

The Subtotal command inserts a summary row whenever the value in your chosen column changes. It has no memory of categories it has already seen, so if the categories are scattered it dutifully subtotals each run. Sorting by that column first gathers each category into one block, and you get one subtotal per category.

Subtotals add an outline down the left edge with numbered buttons. Clicking 1 shows the grand total alone, 2 shows category subtotals, and 3 shows every row. That collapsibility is the real benefit — the same sheet serves both a manager wanting four numbers and an analyst wanting all 900 rows.

Subtotals insert real rows into your data, which means the range is no longer a clean data set — sorting it again will scramble the subtotal rows in with the data. Remove them with Data > Subtotal > Remove All before doing anything else with the range. For repeated analysis, a PivotTable is the better tool, because it summarizes without altering the source at all.

Why Groups and Subtotals Matter

Large datasets can quickly become overwhelming. Groups and Subtotals allow you to organize data into collapsible sections and automatically calculate summaries such as totals, counts, or averages.

When subtotals are applied, Excel creates an outline structure that lets you expand or collapse levels of detail.

Grouping Rows or Columns

You can manually group selected rows or columns to create collapsible sections.

  1. Select the rows or columns you want to group.
  2. Go to the Data tab.
  3. Click the Group command in the Outline group.
Group command on Data tab
Grouped columns example
Selected columns are grouped and can now be collapsed.

Hide and Show Detail

Once data is grouped, minus (-) and plus (+) buttons appear to the left of the worksheet.

Click the minus sign to collapse (hide) detail. Click the plus sign to expand (show) detail.

Hide detail button
Collapsed group view

Important: Sort Before Using Subtotal

Before creating subtotals, you must sort your data by the column you plan to group by.

For example, if you want to subtotal by T-Shirt Size, sort the worksheet by T-Shirt Size first.

Sorting data before subtotaling

Creating a Subtotal

  1. Sort your worksheet by the column you want to subtotal.
  2. Go to the Data tab.
  3. Click Subtotal.
Subtotal command on Data tab

In the Subtotal dialog box:

Subtotal dialog showing Count function

• At each change in: Select the grouping column (e.g., T-Shirt Size) • Use function: Choose COUNT, SUM, AVERAGE, etc. • Add subtotal to: Select the column to calculate

Subtotal dialog selecting T-Shirt Size

Understanding Outline Levels

After applying subtotals, Excel creates outline levels on the left side of the worksheet.

Level 1 shows only the Grand Total. Level 2 shows subtotal rows. Level 3 shows all detailed data.

Level 1 outline
Level 2 outline
Level 3 outline
Full subtotal result

Removing Subtotals

To remove subtotals entirely:

  1. Go to Data → Subtotal.
  2. Click Remove All.
Remove All in Subtotal dialog

Clearing Groups Without Removing Data

If you want to remove grouping but keep the data, use Clear Outline.

Clear Outline option

Knowledge Check

Check your understanding

What does the Subtotal command do?

Practice File

Download this file and follow along with the lesson.

Challenge

Apply what you've learned in this lesson.

Download the practice workbook and complete the following:

  1. Click the Challenge tab.
  2. Sort the worksheet by Grade from Smallest to Largest.
  3. Use Subtotal to group at each change in Grade.
  4. Use the SUM function.
  5. Add subtotals to Amount Raised.
  6. Select outline Level 2 so only subtotals and the grand total appear.
Challenge final subtotal view
Final result should display subtotal rows and the grand total only.

Finished this lesson?

Progress is saved in this browser only. It is not a grade — official progress lives in Brightspace.