Excel subtotals let you summarize, group, and analyze your data efficiently. Instead of manually adding values, you can instantly see sums, averages, counts, or other functions across subsets of your data, saving hours of work. The key is selecting the right range, choosing the correct subtotal field, and formatting the display properly—especially when dealing with hidden or collapsed rows. You’ll also learn how to handle errors, reset subtotals, and apply them to dynamic data.

What You'll Need

  • An Excel spreadsheet (Excel 2013 or newer; the method works in Excel Online)
  • A column or row with data you want to group and summarize (at least three rows)
  • Your mouse or keyboard to navigate cells; Excel’s built-in functions and menus handle the rest

Step-by-Step

  1. Prepare your data
    1. Ensure your data is organized in a single table or range, with clear column headers (e.g., "Category," "Quantity," "Total"). Avoid merging cells or formatting that would prevent Excel from recognizing rows.
    2. If you’re working with hidden rows (e.g., collapsed groups in Power Query), make them visible by right-clicking a header and selecting "Unhide."
    3. For grouped data (e.g., years in a month-by-month table), expand each group so subtotals appear below each category before applying the function.
  2. Select the range for subtotaling
    1. Click the cell below the last row you want to subtotal (e.g., if you’re summarizing rows A2:A100, select A101).
    2. Drag your mouse to include the column(s) you’ll analyze (e.g., A101:B101) and the subtotal function you want to apply (e.g., sum, average, count).
      1. For subtotaling only one column (e.g., sums by category), select that column + the next empty row (e.g., B101:B101 if B is the category column).
      2. For multi-column subtotals (e.g., sums per product + average price), use the full range (e.g., B101:D101).
  3. Insert the subtotal function
    1. Go to the Data tab in the ribbon. Click Subtotal in the Data Tools group.
      1. In the Subtotal dialog box, under "Where Subtotal Applies," select the column you want to group by (e.g., "Category"). Ensure it’s the only column checked—Excel will ignore other columns unless they’re part of a multi-column filter.
      2. In the "Subtotal On" section, choose the function you want (e.g., "Sum," "Average," "Count," "Min," "Max").
        • For a single function (e.g., sums only), select just that option.
        • For multiple functions (e.g., sum + average), check all relevant boxes.
      3. For "Show Subtotal" and "Skip Level," use these only if you’re working with a complex hierarchy (e.g., yearly subtotals within monthly data). Typically, leave them at the default ("Show Subtotal").
  4. Adjust display options
    1. Right-click the subtotal cell(s) and choose Format Cells > Number. Select "Custom" and enter a format like "#,##0" for easy readability (e.g., "1,234.56").
    2. To hide subtotal lines (e.g., in large reports), use the Show/Hide group: Click the "Group" button to expand/collapse rows, then check "Show Subtotal" in the Format Cells dialog.

Common Mistakes

  1. Ignoring hidden rows

    If rows are collapsed (e.g., in Power Query), Excel won’t count them. Unhide them first via the menu path above Data > Unhide, or ensure you’ve expanded all groupings before subtotaling.

  2. Selecting the wrong column for grouping

    Excel subtotals require a single column to "group by." If you accidentally select multiple columns in "Where Subtotal Applies," the function will fail or create unexpected results. Double-check the selection in the Subtotal dialog.

  3. Overwriting or deleting data

    Subtotals add formulas to the selected range. If you delete rows below the subtotal or modify the original data, the subtotal will reset. To protect your work, copy the subtotal range to a new worksheet or use the Data > Subtotal method on a copy of your data.

  4. Using subtotals for dynamic data

    Subtotals update only when the underlying data changes. For real-time analysis, combine them with PivotTables or Formulas (e.g., `SUMIF` or `AVERAGEIF`). Subtotals won’t update until you refresh the Data tab.

  5. Forgetting to include empty rows

    If your data ends abruptly, Excel may not recognize the last row. Add a blank row after the final data point (e.g., row 101 if data ends at row 100) to ensure the subtotal appears correctly.

Tips

  1. Speed up subtotaling with shortcuts
    1. Press Ctrl + T to insert a new table, then use Data > Subtotal inside the table. This auto-selects the correct range.
    2. For multiple columns, use the Data > Filter tool to group data first, then apply subtotals. Hover over the filter dropdown to see the grouped values.
  2. Reset subtotals later
    1. Click Data > Subtotal again. In the dialog, select "Where Subtotal Applies" as none, then choose "None" for all functions. This removes subtotals without deleting your data.
    2. For stubborn subtotals, delete the subtotal row(s) manually and reapply the function.
  3. Subtotals in Excel Online
    1. Online uses the same Data > Subtotal method, but menus may appear differently (e.g., "Subtotal" might be in the Analyze tab). If it doesn’t work, use =SUMIF in a separate column.
    2. Online lacks hidden row support, so always expand groups before subtotaling.
  4. Conditional subtotals
    1. Use Data > Filters > Advanced Filter to subset data first (e.g., only rows where "Category" = "A"), then insert subtotals. This avoids over-subtotaling.
    2. For complex logic, replace subtotals with formulas like =SUMIFS(Table1[Quantity], Table1[Category], "A").
  5. VBA for advanced users
    1. Record a macro (Home > Record Macro) when subtotaling to automate repetitive steps. Paste the macro into a custom module for reuse.
    2. For dynamic tables, use VBA’s `WorksheetFunction.Subtotal` with a loop to handle hidden rows.

Troubleshooting

  1. Subtotal doesn’t appear
    1. Check that you selected the correct column for grouping. If it’s empty, Excel won’t show subtotals.
    2. Verify your data isn’t merged into another cell. Right-click the column header and select "Unmerge Cells" if needed.
    3. If the subtotal cell is blank, double-check the function (e.g., try "Count" instead of "Sum") and ensure no data is hidden below the subtotal.
  2. Subtotal resets after copying data
    1. Subtotals are formulas, not static. When pasting into a new sheet, the formulas break. Instead, copy the entire range (including subtotal cells) and paste as values (Ctrl + Shift + V > "Values").
    2. For dynamic data, use PivotTables or `SUMIF`/`AVERAGEIF` formulas.
  3. Subtotal shows incorrect results
    1. If the subtotal doesn’t match your manual sum, check for:
      • Hidden rows or formatted cells (e.g., "Text" misclassified as numbers).
      • Whitespace or blank cells in your group column (e.g., " " instead of "A"). Use the Find dialog (Ctrl + F) to search for blanks.
    2. For errors like "#DIV/0!", ensure no grouping column is empty within a subtotal range.
  4. Subtotal doesn’t update when data changes
    1. Subtotals update automatically if the original data changes except when:
      • The data is in a protected worksheet (unprotect first: Review > Protect Sheet).
      • You’re using Excel Online (refresh the Data tab).
    2. For real-time updates, replace subtotals with =SUMIF formulas:
            =SUMIF(CategoryColumn, "GroupA", QuantityColumn)
            
  5. Subtotal column shows blank entries
    1. If subtotaling a single column (e.g., "Sum of Quantity"), ensure the column is numeric. Convert text to numbers via Home > Replace.
    2. For grouped data with no entries (e.g., "Category" = "X" has no rows), Excel won’t display a subtotal. Use IFERROR to show "0": =IFERROR(SUBTOTAL(9, QuantityColumn), "0").

Frequently Asked Questions

Can I use subtotals with Power Query?

Yes, but subtotals in Power Query are limited. Instead:

  1. Transform your data into a table (Home > Transform > Combine > Table).
  2. Apply subtotals via Data > Subtotal on the new table.
  3. If Power Query groups data by default, expand each group before subtotaling.

How do I subtotal in Excel for Mac?

Mac Excel (Excel for Mac) uses the same Data > Subtotal menu. If the option is missing:

  1. Ensure you’re using Excel 2016 or later (older versions lack subtotal support).
  2. For older Mac versions, use =SUMIF(CategoryColumn, "GroupA", QuantityColumn) instead.

What if my subtotal keeps resetting to zero?

Zero subtotals typically mean:

  1. Your grouping column contains no valid entries (e.g., all "GroupA" rows are empty). Use =IF(SUBTOTAL(9, QuantityColumn) > 0, SUBTOTAL(9, QuantityColumn), "N/A").
  2. The data range is incorrect (e.g., you selected the wrong cells). Double-check with the Subtotal dialog.
  3. Your worksheet is protected. Unprotect it via Review > Protect Sheet.

Can I freeze rows while using subtotals?

Yes, but subtotals won’t update if you:

  1. Freeze rows after subtotaling (View > Freeze Panes).
  2. Use Excel Online (subtotals update only after refreshing).
Instead:
  1. Apply subtotals first, then freeze rows (View > Freeze Panes).
  2. For dynamic data, use =SUMIF formulas with no freezing.

How do I subtotal nested groups (e.g., yearly subtotals within monthly data)?

Use the "Skip Level" option in the Subtotal dialog:

  1. Group by month (e.g., "January 2023").
  2. Apply subtotals for "Sum" (level 1 = monthly totals).
  3. In the Subtotal dialog, check "Skip Level" and select the next grouping level (e.g., "Year"). This creates yearly subtotals below monthly totals.

Why do subtotals ignore my formatted cells?

Excel subtotals treat cells as raw data. Formatting (e.g., currency symbols, dates) is ignored unless you:

  1. Convert text to numbers (Home > Number > Text to Columns).
  2. Use a formula like =SUBTOTAL(9, QuantityColumn) to bypass formatting.
  3. Apply a custom number format (e.g., "0") to subtotal cells.