How to Subtotal Numbers in Excel
In this article
Subtotaling numbers in Excel lets you quickly summarize groups of data by applying functions like SUM, AVERAGE, or COUNT to each group, while keeping the original data intact. This is especially useful for sales reports, inventory logs, or expense trackers where you have repeated categories like regions, product types, or dates. Before you begin, make sure your data is sorted by the column you want to group by — Excel’s Subtotal feature relies on contiguous, sorted groups to work correctly.
What You'll Need
- A Microsoft Excel workbook (2010 or later)
- A dataset with at least two columns: one for grouping (e.g., Region, Product) and one for numeric values (e.g., Sales, Quantity)
- Sorted data by the grouping column
Step-by-Step
- Open your Excel workbook and select the entire data range, including headers. For example, if your data spans from cell A1 to D50, click and drag to highlight all of it.
- Go to the Data tab on the Ribbon at the top of Excel.
- In the Outline group, click Subtotal. A dialog box titled "Subtotal" will appear.
- In the "At each change in" dropdown, select the column you want to group by — for example, if your data has a "Region" column, choose "Region".
- In the "Use function" dropdown, pick the calculation you want: SUM is most common for totaling numbers, but you can also choose AVERAGE, COUNT, MAX, MIN, or others.
- In the "Add subtotal to" section, check the box next to the numeric column you want to subtotal. If you have multiple numeric columns (e.g., Sales and Units), check all of them you want summarized.
- Leave "Replace current subtotals" checked unless you’ve previously added subtotals and want to preserve them.
- Leave "Summary below data" checked for standard layout; uncheck it if you prefer summaries to appear above each group.
- Click OK. Excel will insert subtotal rows after each group, apply the function, and add a grand total at the bottom.
- After subtotals are applied, you’ll see small buttons on the left margin (1, 2, 3). Click "2" to show only group subtotals without detail rows, or "3" to show everything including grand total.
Common Mistakes
- Not sorting data before applying subtotals — this causes Excel to create incorrect or fragmented subtotals because it can’t identify continuous groups.
- Applying subtotals to unstructured data: if your dataset has blank rows, merged cells, or inconsistent formatting, subtotals may skip groups or miscount.
- Selecting the wrong column in "At each change in" — if you choose a column with many unique values (like customer ID), Excel will create a subtotal for every row instead of grouped categories.
- Forgetting to check the correct numeric column in "Add subtotal to" — if you don’t select the column with numbers, no calculation will be applied.
- Using Subtotal on filtered data without realizing it — subtotals include hidden rows by default; use the filter toggle (button "3") to hide detail rows if needed.
Tips
- Always sort your data first. Use the Data > Sort option, then pick your grouping column as the primary sort key. This ensures Excel recognizes each group correctly.
- Use named ranges for large datasets — select your data, then go to Formulas > Define Name and assign a name like "SalesData". This makes formulas and future subtotals easier to manage.
- After applying subtotals, you can still sort or filter the data — but avoid deleting rows manually; use the outline buttons (1, 2, 3) to collapse or expand sections instead.
- For dynamic reports, consider combining Subtotal with PivotTables. PivotTables update automatically when source data changes, whereas subtotals require reapplying if data is modified.
- Use the keyboard shortcut Alt + Subtotal (Alt + Shift + + on Windows) to open the Subtotal dialog quickly if you use this feature often.
- Format subtotal rows differently — select them, right-click, choose Format Cells, and apply bold text or a light background color so they stand out.
Troubleshooting
- If subtotals appear in the wrong places or repeat oddly, your data is likely not sorted. Go back, sort by the grouping column, and reapply the Subtotal function.
- If you don’t see the Subtotal button under the Data tab, check that you’re using Excel for Windows or Mac — it’s not available in Excel Online or mobile apps.
- If Excel says "There was a problem with the subtotal" or the dialog won’t open, your selection may include non-continuous data. Ensure your entire dataset is selected as one block without gaps.
- If subtotals are missing for some groups, look for blank cells or inconsistent text entries (e.g., "North" vs. "north"). Standardize spelling and capitalization in your source data.
- If the grand total is incorrect, check whether you’ve accidentally included non-numeric entries (like text) in the numeric column. Excel ignores text in SUM but may affect other functions.
- To remove subtotals entirely, go to Data > Subtotal again and click "Remove All". This clears all subtotal rows without affecting your original data.