Microsoft Excel Training

Creating Automatic Subtotals

Learn to group a data list, calculate totals or counts for each category, use Excel’s outline controls, and remove subtotal calculations when finished.

Start here

Overview

This lesson uses TripData to organize records by destination and create automatic group summaries with Excel’s Subtotal feature.

What You Will Learn

  • Sort records by the field used to create groups.
  • Create Sum subtotals whenever the grouping value changes.
  • Use outline levels to display details, group totals, or only the grand total.
  • Add a Count subtotal without replacing the existing Sum subtotal.
  • Change the subtotal function when a different summary is needed.
  • Remove all automatic subtotals and restore the original list.

Before You Begin

  • Working with data lists and field headings
  • Sorting records
  • Basic SUM, COUNT, and AVERAGE concepts

Why This Matters

Automatic subtotals turn a long list into a readable management report without requiring a separate formula for every category.

Plan Your Study

  • Download TripData and sort the records by Destination.
  • Create a Sum subtotal for the Cost field.
  • Experiment with outline levels 1, 2, and 3.
  • Add Count as a second subtotal calculation.
  • Remove all subtotals and compare the restored worksheet.

Next step

Read the complete chapter.

The Learn tab contains the written lesson from Surviving Statistics.

Go to Learn

Written lesson

Learn Creating Automatic Subtotals

Learn to group a data list, calculate totals or counts for each category, use Excel’s outline controls, and remove subtotal calculations when finished.

Advertisement

Creating Automatic Subtotals in Excel

This lesson explains how to sort a data list and use Excel’s Subtotal feature to calculate group totals, counts, averages, and other summary statistics.

▶
Watch the video—Using Excel's Filtering and Subtotal Features Watch video

⬇
Download TripData to complete the lesson Open or download

Creating Automatic Subtotals

When you are dealing with many records, Excel’s Subtotal feature allows you to group and summarize values in that data. You can perform basic statistical functions such as sum, average, or count for groups of records, such as by trip destination with this example. You can also use Excel’s subtotal feature to create slightly more complex statistical analysis by computing standard deviation and variance.

To “group” the records, you will first need to sort the records by the field you intend to group on.

1. Click in the Destination field. In the Sort & Filter group on the Data tab, use the Sort A to Z button to sort the records based on the Destination field in ascending order.

Microsoft Excel lesson screenshot Filters1

2. Be sure the active cell is within the database. Click the Subtotal tool in the Outline group on the Data tab.

Microsoft Excel lesson screenshot Filters2

In the Subtotal dialog box, you will select which field determines how the records are subdivided. You will also select which computation will be performed (i.e., sum, average, etc.) and which field values will be used in the computation.

Microsoft Excel lesson screenshot Filters3

3. Select Destination in the At each change in text box (which establishes the groups).

This tells Excel to compute a subtotal each time the Destination field value changes. You sorted the records by destination in ascending order so the destinations would be grouped together.

4. Select Sum as the function. Select Cost as the field to Add subtotal to; these values will be used in the computation.

Leave the other options as shown.

5. Click OK

Your worksheet should look like the one below. You should see a total computed for each destination. Did you notice that the Subtotal tool was in the Outline group when you selected it? Do you remember when we experimented with outlining in the Excel: Beyond the Basics course that preceded this one? Notice the outline level numbers and controls left of the column headings and row numbers. We will explore these next.

Microsoft Excel lesson screenshot Filters4

Expanding and Collapsing Subtotals

The Excel workbook currently shows all records (details), group totals (subtotals), and the grand total (summary). You can click on the outline level numbers 1, 2, or 3 to see just the grand total (level 1), the grand and group totals (level 2), or all information (level 3). You can also click on the outline buttons to the left of the row numbers. The level 2 buttons (+ or -) will expand or collapse the group records, but not the subtotals.

Microsoft Excel lesson screenshot Filters5

1. Click on the “2” to the left of Column A’s heading.

Excel should now show the subtotal for each destination and the grand total. Experiment with the various outline levels. Also look at the worksheet in Print Preview; the worksheet will print as it is displayed on screen.

Adding more subtotals

The subtotals you created added a sum or total for each destination and a grand total. This is because you selected Sum as the subtotaling function. If you decided that you wanted the record count instead of the total, you could click the subtotal tool again and choose Count instead of Sum. By default, Excel will replace the Sum computations with a count.

However, there may be times when you want two computations to display on the worksheet when you are using the Subtotal feature. In this portion of the lesson you will add a Count for each destination, but leave the Sum as it is.

2. Ensure the active cell is located in the database area and click the Subtotal tool again.

Microsoft Excel lesson screenshot Filters6

3. In the Subtotal dialog box, change the function to Count. Then turn off the Replace Current subtotals check box and click OK.

Microsoft Excel lesson screenshot Filters7

You should now see that Excel added the count and the total to the worksheet. Adjust the destination’s column width if needed to see the complete titles.

Removing Subtotals

Changing the computation to be performed on the grouped items or removing the subtotals is simple with the Subtotal dialog box. To change the computation, just click on the Subtotal tool when any cell in the database is active. You might try changing the computation to group averages and grand average for our current database.

1. With the active cell in the database area, click the Subtotals tool in the Outline group on the Data tab.

The Subtotal dialog box should appear.

Microsoft Excel lesson screenshot Filters8

2. In the Subtotal dialog box, click Remove All.

Excel will now remove all subtotals (the group and grand totals) calculated for the database records.

Advertisement

Next step

See the concepts demonstrated.

Continue to Watch for chapter videos and worked examples.

Go to Watch

See it explained

Watch

Choose the explanation or example that best supports your learning.

Next step

Apply what you have learned.

Use the guided questions and activities in Practice.

Go to Practice

Apply what you learned

Practice Creating Automatic Subtotals

Use TripData to create destination totals and record counts, then control how much detail appears with the outline buttons.

Guided Practice

  • Sort the database by Destination in ascending order.
  • Create a Sum subtotal for Cost at each change in Destination.
  • Display only the group totals and grand total with outline level 2.
  • Add Count without replacing the existing Sum subtotals.
  • Remove all automatic subtotals.

Challenge Yourself

  • Replace the subtotal calculation with Average and compare the report.
  • Create subtotals using another grouping field.
  • Print-preview the worksheet at each outline level.

Check Your Understanding

  • Can you explain why the records must be sorted before subtotals are created?
  • Can you distinguish a group subtotal from the grand total?
  • Can you explain what Replace Current Subtotals controls?

Next step

Save the materials you may need later.

Open Resources for the study sheet, spreadsheets, and related learning materials.

Go to Resources

Keep learning

Resources

Study sheets, downloadable files, companion tools, and related lessons for this chapter.

For educators

Teaching this chapter?

The Instructor tab contains objectives, teaching ideas, assessments, and a printable guide.

Open Instructor Resources

LutherMaddy.com — Helping Humans Learn

Creating Automatic Subtotals: Instructor Resources

Teach this lesson

Instructor Resources

Classroom-ready objectives, teaching ideas, questions, and assessment materials for this chapter.

Learning Objectives

  • Sort records by the field that defines subtotal groups.
  • Create grouped summaries with Excel’s Subtotal command.
  • Use outline levels to display the desired amount of detail.
  • Add multiple subtotal functions without replacing existing summaries.
  • Remove all automatic subtotals safely.

Prerequisite Knowledge

  • Data lists with headings
  • Sorting
  • SUM, COUNT, and AVERAGE

Teaching Outline

  • Explain why the grouping field must be sorted.
  • Create Sum subtotals for one numeric field.
  • Demonstrate outline levels and expand/collapse buttons.
  • Add Count without replacing Sum.
  • Change or remove the subtotal calculations.

Key Concepts

  • Excel inserts a subtotal whenever the sorted grouping value changes.
  • Outline levels separate details, group totals, and the grand total.
  • Replace Current Subtotals controls whether a new function replaces or supplements the existing one.
  • Remove All restores the original list structure.

Classroom Demonstration

  • Create subtotals on unsorted data and compare the incorrect grouping with the sorted result.
  • Display the same report at outline levels 1, 2, and 3.

Questions to Ask

  • Why must matching categories be adjacent before subtotaling?
  • When would Count be more meaningful than Sum?
  • How do outline levels improve a printed management report?

Teaching Notes

  • Have students keep a clean copy of the original data.
  • Confirm that the active cell is inside the data list before opening Subtotal.
  • Explain that automatic subtotals alter the worksheet by inserting rows.

Assessment Ideas

  • Create Sum subtotals by one category.
  • Add Count without replacing Sum.
  • Display only group totals and the grand total.
  • Remove all subtotal rows and outline controls.

Grading Rubric

CriterionPoints
Data sorted correctly2
First subtotal configured correctly2
Outline levels used correctly2
Second subtotal added correctly2
Subtotals removed and data restored2
Total10

Exam and Discussion Questions

Basic

  • State why data should be sorted before using Subtotal.

Applied

  • Create both Sum and Count subtotals for a grouped data list.

Conceptual

  • Explain the difference among outline levels 1, 2, and 3.

Keep Exploring

Continue Learning

Explore step-by-step lessons, interactive calculators, downloadable study sheets, and practical educational resources.