Excel’s Subtotal feature automatically sums, averages, counts, or applies other functions to grouped data without manually recalculating. If you need to subtotal 9, you’re likely looking to sum values in a range, apply conditional logic, or use a hidden row to group totals—Commonly, this means you want to add rows between sections of your data to create running totals, per-category summaries, or intermediate calculations before final totals. To do this, you’ll use the SUBTOTAL function or the Subtotal command in the Data tab. Both methods handle hidden rows and conditional aggregation, making them ideal for reports with dynamic data. Without them, you’d have to manually insert blank rows and use formulas like SUMIF or SUM with conditional logic, which is error-prone when data grows or filters change. The SUBTOTAL function also supports filters and sorting, so you won’t need to adjust calculations manually.
What You'll Need
- A spreadsheet file or open Excel (Desktop or Online)
- The data you want to subtotal, organized in rows/columns (e.g., sales records grouped by region)
- Knowledge of basic Excel ranges (e.g., A2:A10, B5:B20)
- A hidden row or column to insert subtotals (if using the Subtotal command)
- Optional: A helper column to store intermediate results (e.g., for debugging)
Step-by-Step
- Prepare your data
- Ensure your data is sorted or grouped logically. For example, if you’re subtotaling sales by region, sort by region first.
- Use hidden rows if you want to skip them in calculations. To hide a row, select it and press
Ctrl + H. - If you’re using the
SUBTOTALfunction, note that it only sums rows that are visible in the current view. Hidden rows won’t count unless you adjust settings.
- Insert subtotals using the Subtotal command
- Go to the Data tab in the Ribbon. In the Outline group, click Subtotal.
- A dialog box will appear. Under Show subtotals on, select the rows or columns where you want to insert subtotals (e.g., every 5th row, every 5th column).
- Under Subtotal calculations, choose the function you want (e.g., Sum, Average, Count). For your specific case of summing a subtotal of 9, select
Sum(if that’s what you’re using). - Click OK. Excel will insert blank rows or columns after every group of 9 visible rows/columns. These rows will act as subtotal rows.
Note: If you want subtotals of 9 between existing data (not necessarily every 9 rows), adjust the "Every" setting to 9 in the dialog. For example, if you have 100 rows and want to sum every 9 rows, set "Every" to 9 and click OK. Excel will then add subtotal rows after rows 9, 18, 27, etc.
Troubleshooting: If subtotals appear in the wrong place, delete the inserted rows, go back to Data > Subtotal, and specify the correct grouping (e.g., 10 rows per subtotal).
- Use the SUBTOTAL function (alternative method)
- In a blank cell (e.g., D1), enter the formula:
=SUBTOTAL(103, A2:A100) - The
103refers to the function type. For summing, use103; for average, use102; for count, use101. - Drag the formula down or across to apply it to other ranges.
Key difference: The
SUBTOTALfunction ignores hidden rows by default (set via View > Hide Rows). To include hidden rows, use104for Sum,105for Average, etc. For example:=SUBTOTAL(104, A2:A100) - In a blank cell (e.g., D1), enter the formula:
- Verify and adjust calculations
- Check that subtotals match your expectations. If they don’t (e.g., subtotals are off by 1), manually insert a blank row before the subtotal and ensure no hidden rows are interfering.
- For dynamic data (e.g., filtered views), ensure your ranges are correct. If filtering hides rows, the subtotal may not update. Use
SUBTOTAL(103, $A$2:$A$100)(with absolute references) to force updates.
Common Mistakes
- Forgetting to sort data first
- Subtotals only work on sorted data. If your data isn’t grouped, subtotals will appear in the wrong place or not at all.
- Fix: Sort your data before inserting subtotals (e.g., by category, date, etc.).
- Using the wrong function type
- If you need a sum, use
103(SUBTOTAL) orSUM. Using102(Average) will give incorrect results. - To count rows, use
101(SUBTOTAL) orCOUNTIF.
- If you need a sum, use
- Ignoring hidden rows
- By default, SUBTOTAL ignores hidden rows. If you want to include them, use
104(Sum),105(Average), etc. - Alternatively, unhide rows or adjust the range to exclude hidden areas.
- By default, SUBTOTAL ignores hidden rows. If you want to include them, use
- Not updating filtered views
- If you filter a column, subtotals may not update automatically. Use absolute references (e.g.,
$A$2:$A$100) in SUBTOTAL formulas to force recalculation. - For the Subtotal command, right-click a subtotal row, select Edit Subtotal, and uncheck Show subtotals on to force a recalculation.
- If you filter a column, subtotals may not update automatically. Use absolute references (e.g.,
- Incorrect range selection
- If your range is too small (e.g., only 5 rows), SUBTOTAL may fail or return #N/A. Ensure your range is large enough for the subtotal interval (e.g., 9 rows for a 9-row subtotal).
- Use
Subtotal > Every 10 rowsand adjust as needed.
Tips
- Use helper columns for debugging
- Insert a column to manually sum the same data as your subtotal. Compare results to catch errors.
- Example: If your data is in column A, add column B with
=SUM(A2:A9)and compare withSUBTOTAL(103, A2:A100).
- Combine SUBTOTAL with PivotTables
- For complex reports, use a PivotTable to summarize data by category, then use SUBTOTAL to add row-level subtotals within the PivotTable.
- Right-click a row in the PivotTable > Add Field to Row Labels > Subtotal and select
Sum.
- Lock references in formulas
- Use absolute references (e.g.,
$A$2:$A$100) in SUBTOTAL formulas to avoid errors when dragging. - This forces the formula to recalculate even if the range expands or contracts.
- Use absolute references (e.g.,
- Use conditional formatting to highlight subtotals
- Select the subtotal row, go to Home > Conditional Formatting > New Rule, and format cells that match your subtotal logic.
- Example: Format cells where the subtotal equals 999 (your sum threshold).
- For large datasets, use SUMIF or SUMIFS
- If you’re subtotaling by a specific category (e.g., "North America"), use:
=SUMIF(A:A, "North America", B:B) - For multiple criteria:
=SUMIFS(B:B, A:A, "North America", C:C, ">100")
- If you’re subtotaling by a specific category (e.g., "North America"), use:
Troubleshooting
- Subtotal not appearing at all
- Check if your data is sorted. Subtotals require grouped, sorted data.
- Ensure you’re using the correct function (e.g.,
103for Sum). - If using the Subtotal command, verify the "Every" setting matches your data. For example, if you have 20 rows and want subtotals every 9, set "Every" to 9.
- Restart Excel to clear any caching issues.
- Subtotal is off by 1 or missing values
- Manually insert a blank row before the subtotal and ensure no hidden rows are interfering.
- Use the SUBTOTAL function with absolute references (e.g.,
SUBTOTAL(103, $A$2:$A$100)). - Check for hidden rows in the range. Unhide them if necessary.
- Subtotal updates slowly or freezes Excel
- Close other tabs and minimize open windows to free up memory.
- Increase Excel’s calculation speed:
- Go to File > Options > Advanced.
- Under Performance, check Calculate automatically and adjust the slider for "Calculate workbooks when opening them."
- Switch to manual calculation mode:
- Go to File > Options > Advanced
- Uncheck Calculate automatically and click OK.
- Manually press F9 to recalculate.
- Subtotal formula returns #N/A
- Check that your range is correct. For example, if you’re subtotaling rows 2–100, use
A2:A100. - Ensure the function type matches your goal (e.g., use
103for Sum, not42, which is a placeholder). - If using absolute references, ensure they’re locked (e.g.,
$A$2:$A$100). - Try recalculating: Alt + F8 > Select the formula > Calculate (in the dialog, click Calculate).
- Check that your range is correct. For example, if you’re subtotaling rows 2–100, use
- Subtotal doesn’t update after filtering
- Use the Subtotal command and right-click a subtotal row > Edit Subtotal > Show subtotals on. Uncheck any filters to force a recalculation.
- For SUBTOTAL functions, add
!Abefore the range (e.g.,SUBTOTAL(103, !A2:A100)). This forces the formula to use the current filter.
Frequently Asked Questions
How do I subtotal every 9 rows in Excel?
Use the Subtotal command:
- Go to Data > Subtotal.
- Under Show subtotals on, select Every 9 rows.
- Under Subtotal calculations, choose
Sum. - Click OK. Subtotals will appear after every 9 visible rows.
Can I subtotal hidden rows in Excel?
By default, SUBTOTAL ignores hidden rows. To include them, use function codes like 104 (Sum), 105 (Average), etc. For example:
=SUBTOTAL(104, A2:A100)
Why is my subtotal calculation wrong?
Possible reasons:
- Data isn’t sorted. Sort the data before subtotaling.
- Incorrect function type (e.g., using
102for Average when you need Sum). - Hidden rows are interfering. Unhide them or use
104to include them. - The range is too small. Ensure your range includes enough data for the subtotal interval.
How do I remove subtotals in Excel?
To delete subtotals:
- Right-click the subtotal row > Edit Subtotal > Show subtotals on.
- Uncheck the rows/columns you subtotaled and click OK.
- Alternatively, delete the blank rows/columns manually.
Can I subtotal by category with SUBTOTAL?
No, SUBTOTAL only groups data by rows or columns (e.g., every 9 rows or every 3 columns). For category-level subtotals, use:
SUMIF(e.g.,=SUMIF(A:A, "North America", B:B)), or- A PivotTable with a Subtotal field, or
- Conditional SUM formulas with multiple criteria (e.g.,
SUMIFS).
How do I force SUBTOTAL to recalculate after filtering?
Use absolute references in your formula (e.g., SUBTOTAL(103, $A$2:$A$100)) or force a manual calculation via the Subtotal command (right-click subtotal > Edit Subtotal > uncheck filters).