• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

How to Insert Subtotals in Excel

You are here: Home / Excel Formulas / How to Insert Subtotals in Excel
How to Insert Subtotals in Excel
February 4, 2011 by Mynda Treacy

The Subtotal tool in the Outline group on the Data tab of the ribbon automatically inserts subtotal formulas and grand totals for a column or columns. Excel subtotals can be SUM’s, AVERAGE’s, COUNT’s, MIN, MAX and more.

This tool can give you valuable information in a few clicks, transforming your data like this:

before subtotals after subtotals

How to Format Your Data

First make sure your data is laid out in a sorted table; i.e. the columns you want your subtotal based on must be sorted, like in the example below column A & B are sorted. It must also have column labels, also called a header row, and no blank rows or columns.

Note: You cannot use the Subtotal tool with data formatted in an Excel Table. You need to convert it to a range first.

Insert Excel Subtotals

Using the data below we’re going to insert a subtotal that SUM’s the ‘Jumps’ column at every change in the ‘Solar System’.

raw data

First select a cell anywhere in your table. Then on the Data tab in the Outline group, select Subtotal.

The window below will open.

Excel subtotals dialog box

1.       Here you can select the column you want your subtotals based on by choosing from the ‘At each change in:’ list. We’ll select ‘Solar System’.

2.       Select what type of subtotal you want inserted in the ‘Use function:’ list. You can choose from SUM, AVERAGE, COUNT, MIN, MAX and a few more. We’re going to select SUM.

3.       In the ‘Add subtotal to:’ list you can select which columns you want summarised. We’ll select ‘Jumps’ but we could also select the ‘Duration’ column as this has values that can be summed.

4.       You can then select from the check boxes:

  • Replace current subtotals: Handy if you’ve already inserted some but you want to change them.
  • Page break between groups: Useful for printing your data.
  • Summary below data: This inserts the subtotals at the bottom of each change in data. Un-checking this inserts it at the top.

5.       Click OK

Our table now looks like this:

table with subtotals inserted

You can see they have been inserted at the bottom of each change in Solar System and notice now you have some new buttons added to the side bar on the left.

These buttons allow you to hide and unhide the detail rows. You can either click the outline symbols outline symbols or the + and – symbols to expand and contract the rows.

Clicking on level 2 shows the Subtotal rows only, like this:

grouped data

Or you can click on the + and – buttons to hide and unhide individual subtotals.

Clicking on level 1 shows the Grand Total only.

How to Nest Subtotals

Taking the example above, let’s say we want to add a subtotal at each change in the Bid column so that we have a subtotal for the ‘Buy’ items and a subtotal for the ‘Sell’ items.

To do this we follow steps 1 to 3 above, and we un-tick the ‘Replace current subtotals’ check box like this so that they are added to the table:

subtotal tool dialog box

Now our table looks like this:

additional subtotals

You can see we’ve now got 4 levels in our outline, and we have additional subtotals inserted in the Bid column to total the Buy and Sell items.

We can keep on nesting subtotals and also change the function thus adding more levels to your outline. For example we’ll add at COUNT to our Bid Column like this:

subtotal tool dialog box

And now our table has 5 outline levels and looks like this:

more subtotals

NOTE: I’ve added this fifth level for demonstration purposes, however bear in mind that there will come a time where your table is simply too busy and other methods of summarising your data would be better.

TIPS:

1.       The subtotals are actually formulas and therefore recalculate as you edit the data in your table. Assuming your workbook is set to automatically recalculate.

2.       The grand totals are calculated from the detail data, not the subtotals. Therefore if you insert an Average the grand total will calculate the average for all of the data.

Enter your email address below to download the sample workbook.



By submitting your email address you agree that we can email you our Excel newsletter.
Please enter a valid email address.

Download the practice workbook here. Note: This is a .xlsx file. Please ensure your browser doesn't change the file extension on download.

How to Insert Subtotals in Excel

More Excel Formulas Posts

ai-aided excel formula editor

AI Aided Excel Formula Editor

Save time with this free AI Excel formula editor add-in that writes, edits, improves and interprets formulas for you!
top excel functions for data analysts

Top Excel Functions for Data Analysts

Must know Excel Functions for Data Analysts and what functions you don’t have to waste time learning and why.
excel advanced formula environment

Excel Advanced Formula Environment

Excel Advanced Formula Environment is a long awaited, new improved way to write, name and store Excel formulas.
Pro Excel Formula Writing Tips

Pro Excel Formula Writing Tips

Must know Excel formula writing tips, tricks and tools to make you an Excel formula ninja, including a new formula editor.
excel shaping arrays

New Array Shaping Excel Functions

The Excel Shaping Array Functions makes it easier than ever to reshape arrays and ranges using these purpose built functions
excel nested if functions what not to do

Excel IF Formulas and What Not To Do

Excel IF formulas can get out of hand when you nest too many IFs. Not only do they become unwieldy they’re difficult for anyone to understand
excel image function

Excel IMAGE Function

The Excel IMAGE Function enables you to embed images in a cell using a formula. It supports BMP, JPG/JPEG, GIF, TIFF, PNG, ICO, and WEBP files

Excel VSTACK and HSTACK Functions

New Excel VSTACK and HSTACK functions makes combining arrays of cells easy and with some clever tricks we can extend their capabilities.
identify overlapping dates and times in excel

Identify overlapping dates and times in Excel

How to identify overlapping dates and times in Excel with a formula that checks a range of cells. Works with Dates and Times.
New Excel Text Functions

TEXTSPLIT, TEXTBEFORE and TEXTAFTER Functions

TEXTAFTER, TEXTBEFORE and TEXTSPLIT are exciting new Excel Text functions. They’re fairly self-explanatory, however TEXTSPLIT has some cool features.


Category: Excel Formulas
Previous Post:Excel VLOOKUP to the Left Using CHOOSEExcel VLOOKUP to the Left Using CHOOSE
Next Post:Excel Dashboard Reportsexcel dashboard reports

Reader Interactions

Trackbacks

  1. Excel COUNTIF and COUNTIFS Formulas Explained • My Online Training Hub says:
    September 16, 2014 at 2:17 am

    […] how to use the COUNTIF formula, but you could also achieve this count by builder using the subtotal tool in the Data […]

    Reply
  2. Microsoft Excel Insert Groups and Outlines Using Data Tools says:
    February 19, 2011 at 10:01 pm

    […] my last tutorial I showed you how to insert a Subtotal using the Subtotal […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Current ye@r *

Leave this field empty

Sidebar

More results...

Featured Content

  • 10 Common Excel Mistakes to Avoid
  • Top Excel Functions for Data Analysts
  • Secrets to Building Excel Dashboards in Less Than 15 Minutes
  • Pro Excel Formula Writing Tips
  • Hidden Excel Double-Click Shortcuts
  • Top 10 Intermediate Excel Functions
  • 5 Pro Excel Dashboard Design Tips
  • 5 Excel SUM Function Tricks
  • 239 Excel Keyboard Shortcuts

100 Excel Tips and Tricks eBook

Download Free Tips & Tricks

Subscribe to Our Newsletter

Receive weekly tutorials on Excel, Power Query, Power Pivot, Power BI and More.

We respect your email privacy

Guides and Resources

  • Excel Keyboard Shortcuts
  • Excel Functions
  • Excel Formulas
  • Excel Custom Number Formatting
  • ALT Codes
  • Pivot Tables
  • VLOOKUP
  • VBA
  • Excel Userforms
  • Free Downloads

239 Excel Keyboard Shortcuts

Download Free PDF

Free Webinars

Excel Dashboards Webinar

Watch our free webinars and learn to create Interactive Dashboard Reports in Excel or Power BI

Click Here to Watch Now

mynda treacy microsoft mvpHi, I'm Mynda Treacy and I run MOTH with my husband, Phil. Through our blog, webinars, YouTube channel and courses we hope we can help you learn Excel, Power Pivot and DAX, Power Query, Power BI, and Excel Dashboards.

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk – For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.