How to Subtotal in Excel: A Practical Guide
Master how to subtotal in Excel using SUBTOTAL and the Subtotal tool. Learn to sum, count, and ignore hidden rows with filters, tables, and datasets, with practical steps and examples.
In this guide you will learn how to subtotal in Excel using the SUBTOTAL function and the built-in Subtotal tool. You’ll cover basic sums, ignoring hidden rows, subtotaling tables, and applying subtotals after filters. By the end you’ll have reusable steps for clean, repeatable totals across datasets. This approach works with headers, totals rows, and columns inside Excel tables.
Why subtotaling data matters in Excel
Subtotaling data is a core skill for turning raw numbers into actionable insights. In everyday spreadsheets you often need to summarize values by category (like Region or Product) without altering the original data. The SUBTOTAL function is designed for this workflow: it can perform multiple calculations (SUM, AVERAGE, COUNT, etc.) and, when used with filters or hidden rows, it can ignore those rows if you choose. This makes subtotals ideal for quick reporting and iterative analysis. According to XLS Library, mastering subtotals reduces errors and saves time when building monthly dashboards or client reports.
In practice, you might have a dataset with Date, Region, Product, and Amount. You want a quick total by Region and a grand total. Subtotals scale to larger datasets: you can subtotal several columns, reuse the same formula, and copy it across rows or columns without rewriting logic. This guide starts with simple steps and expands to advanced scenarios like table references and dynamic subtotals.
Understanding SUBTOTAL vs SUM and function_nums
Excel’s SUBTOTAL function is different from a plain SUM. SUBTOTAL takes a function_num argument that selects the calculation to perform: e.g., 9 for SUM, 2 for AVERAGE, 3 for COUNT, and more. The function can behave differently when rows are hidden or filtered, depending on whether you use the standard codes (9, 2, 3, etc.) or the 101/109 variants that ignore hidden values. For example, SUBTOTAL(9, B2:B100) returns a sum even if some rows are hidden by a filter; SUBTOTAL(109, B2:B100) ignores hidden rows. Excel also offers Data > Subtotal to create automatic groupings and totals as data changes. While both approaches compute totals, SUBTOTAL is more flexible inside formulas, and the Subtotal tool yields a quick, report-ready layout with collapsible sections. XLS Library Analysis, 2026 indicates many readers rely on SUBTOTAL to preserve filter choices and achieve clean summaries.
Subtotal in a flat range vs Excel Tables
You can subtotal in a flat range by pointing SUBTOTAL to a normal data range (e.g., B2:B100). When your data is in an Excel Table, you can use structured references like Table1[Amount] and still apply SUBTOTAL. Tables offer automatic expansion, so new rows are automatically included in your subtotal as you add data. Using a table also makes it easier to combine subtotals with filtering, since the table headers remain stable and formulas automatically propagate down the column. For consistent results, prefer a table when working with regularly updated data, but know that SUBTOTAL works just as well in ranges when necessary.
Subtotal and filters: ignoring hidden rows
If you filter data, you typically want subtotals to reflect only visible rows. Use SUBTOTAL with function_num 9 (SUM) or 109 (SUM, ignoring hidden rows) to achieve this. When using 101/109 variants, hidden rows from filters are excluded from the total. The built-in Data > Subtotal tool also respects filters by creating grouped totals that update as you adjust the display. A common setup is to apply a SUM with a SUBTOTAL on a numeric column, then add a Grand Total row that sums all region subtotals for a final figure.
Subtotal across multiple columns and groups
You can create subtotals for multiple numeric columns by duplicating the SUBTOTAL pattern for each column (e.g., B, C, D). If your data contains hierarchical groups (Region > Category), you can place subtotals at each group level using Data > Subtotal or a combination of SUBTOTAL and IF/DIFFERENCE logic for custom summaries. When working with grouped data, consider controlling display with outline controls so end users can expand or collapse sections while seeing updated subtotals in real time.
Real-world examples: Sales and inventory
Example 1: You have a sales log with Region, Product, and Amount. Subtotal by Region to see regional totals, then compute a Grand Total. Example 2: An inventory sheet lists Item, Category, and Stock. Subtotal by Category reveals stock by group and a total stock across all items. In both cases, the SUBTOTAL function lets you reuse a single formula across the sheet and adjust easily as data grows.
Common pitfalls and troubleshooting
Avoid retyping formulas when you rename ranges or move data. Use structured references (Tables) when possible to maintain formula integrity. If subtotals don’t update after a data change, check that you didn’t lock cells, and verify that the correct function_num and ignoring-hidden-rows options are used. When in doubt, validate outcomes by cross-checking with a manual sum of a known subset to confirm accuracy.
Advanced tips: dynamic subtotals and alternatives
Beyond SUBTOTAL, you can use the AGGREGATE function to create subtotals with more options, including error-ignorant calculations and more nuanced handling of hidden rows. For complex datasets, PivotTables offer a robust alternative for multi-dimensional subtotals and quick filtering. Always document which method you chose and why, so teammates can reproduce the results without guesswork.
Tools & Materials
- Microsoft Excel (any recent version)(Windows or Mac; features compatible with SUBTOTAL and Data > Subtotal)
- Dataset with numeric columns(CSV or Excel workbook; include headers)
- Basic knowledge of formulas(Understanding SUM, AVERAGE, and basic cell references)
- Optional: Excel Table(For structured references and automatic expansion)
- Optional: PivotTables(For advanced, pivot-like summaries)
Steps
Estimated time: 20-40 minutes
- 1
Open your dataset
Launch Excel and load the workbook containing the data you want to subtotal. Confirm numeric columns have consistent formatting and that the header row clearly labels each column.
Tip: Double-check the target column for subtotals to avoid summing non-numeric data. - 2
Decide the calculation type
Choose whether you need a sum, average, count, max, or min. SUBTOTAL uses a function_num to select the calculation.
Tip: Common choice is 9 for SUM, 109 to ignore hidden rows. - 3
Write a basic SUBTOTAL formula
In a new cell, enter =SUBTOTAL(9, B2:B100) to sum B2:B100. Adjust the range to match your data; use 109 if you must ignore hidden rows.
Tip: Copy the formula down to apply to multiple rows or adjacent columns. - 4
Extend to a table with structured references
If data is in a Table (Table1), use =SUBTOTAL(9, Table1[Amount]). Tables auto-adjust as you add rows.
Tip: Tables provide more resilience when adding new data. - 5
Subtotal while filtering
Filter the data to view a subset, then apply SUBTOTAL to see the totals for visible rows only. Use function_num 109 to ignore hidden rows when needed.
Tip: Verify with a quick sum of a visible subset. - 6
Apply subtotals by group using Data > Subtotal
Go to Data > Subtotal, choose the column to subtotal by (e.g., Region) and the function (Sum). Excel creates collapsible groups with subtotals.
Tip: Save your workbook with a descriptive name for future reuse. - 7
Compare with a quick grand total
Add a Grand Total row using a separate SUBTOTAL call to ensure it reflects all subtotals.
Tip: Keep the Grand Total formula outside grouped sections to avoid double-counting. - 8
Validate results
Cross-check a sample of totals against a manual calculation to verify accuracy.
Tip: If discrepancies occur, re-check ranges and ensure no non-numeric data is included. - 9
Explore advanced options
Experiment with AGGREGATE for additional control or PivotTables for multi-dimensional subtotals.
Tip: Document the approach and rationale for future users.
People Also Ask
What is the difference between SUBTOTAL and SUM in Excel?
SUBTOTAL can ignore hidden rows and supports multiple calculations based on function_num, while SUM simply adds all values. SUBTOTAL is ideal for filtered data and dynamic reports.
SUBTOTAL can ignore hidden rows and supports different calculations, unlike SUM which always totals everything.
Can I subtotal data with filters without showing hidden rows?
Yes. Use SUBTOTAL with a function_num such as 109 to ignore hidden rows, or apply Data > Subtotal for grouped totals that respect filters.
Yes, SUBTOTAL with 109 ignores hidden rows, and you can also use the built-in Subtotal tool for grouped views.
Should I subtotal in a Table or in a normal range?
Tables offer structured references and automatic expansion, making subtotals more robust. Ranges are fine for simple, static datasets.
Tables are usually better for dynamic datasets; ranges work fine when data is static.
How do I subtotal by group in Excel?
Use Data > Subtotal to insert group totals by a chosen column (e.g., Region). This creates collapsible sections with subtotals.
Data > Subtotal lets you group by a column and add subtotals for each group.
Which function_num corresponds to AVERAGE or COUNT?
FUNCTION_NUM 1 or 101 for AVERAGE, 2 or 102 for COUNT, 3 or 103 for COUNTA, 9/109 for SUM, etc.
Use function numbers like 1 for AVERAGE and 9 for SUM; 109 ignores hidden rows.
Can SUBTOTAL be used with PivotTables?
SUBTOTAL is often superseded by PivotTables for multi-dimensional summaries, but it can work alongside PivotTables for quick totals in specific ranges.
PivotTables are great for complex subtotals, but SUBTOTAL still helps in straightforward ranges.
Watch Video
The Essentials
- Master SUBTOTAL for flexible, filter-aware totals
- Use 9/109 function_nums for sums with/without hidden rows
- Prefer Tables for stability and automatic expansion
- Leverage Data > Subtotal for quick group totals
- Validate totals with a simple cross-check

