When Excel's SUBTOTAL feature misbehaves — subtotals don't appear, land in the wrong rows, or return zero — the fix is almost always one of four things: unsorted data, blank rows/columns breaking the range, numbers stored as text, or the wrong function selected in the Subtotal dialog. This guide walks you through diagnosing and correcting each cause in a few minutes.

What You'll Need

  • A Windows or Mac computer with Microsoft Excel (desktop version; the steps below use the Windows ribbon, and the Data tab looks slightly different by version and on Mac)
  • Your spreadsheet with the data you want to subtotal
  • A couple of minutes — no add-ins or special tools required

Step-by-Step

  1. Sort your data by the grouping column first. Subtotals only work when identical groups sit together. Click any cell in your data, go to Data > Sort, choose the column you want to group by (for example "Region" or "Category"), and click OK. If groups are scattered, Excel creates a subtotal row for every change in value instead of one per group.
  2. Remove blank rows and columns from the data range. Blank rows cause Excel to treat your data as separate blocks, so subtotals may only apply to the first block. Select any blank rows inside the data, right-click, and choose Delete. Also make sure there are no completely empty columns splitting the table.
  3. Add headers to every column. The Subtotal dialog lists columns by their header row. Click into your data, then open Data > Subtotal. If some columns show as "Column1" or are missing, their header cells are blank — cancel, fill them in, and reopen the dialog.
  4. Check whether your numbers are actually numbers. If subtotals show 0 or don't calculate, the values are probably stored as text (common after importing CSV files). Select the column, and if a small warning icon appears, click it and choose Convert to Number. Alternatively, select an empty cell, copy it, select the numeric range, then use Home > Paste > Paste Special > Add. Text numbers convert to real numbers and the subtotal will calculate.
  5. Run Subtotal with the right settings. Click a cell inside your data and go to Data > Subtotal. Confirm the range shown in "At each change in" is your sorted grouping column, pick the correct function (Sum for totals, Count for counting entries), tick the column(s) to subtotal under "Add subtotal to," and click OK.
  6. Clear old or duplicated subtotals before retrying. If you've run Subtotal more than once, or rows look scrambled, open Data > Subtotal and click Remove All to strip out previous subtotal rows, then reapply. This deletes only the inserted subtotal rows and outline, not your original data.
  7. Verify the grouping column has no stray differences. If you get far too many subtotal rows, look for trailing spaces or inconsistent spelling in the group column (e.g. "East " vs "East"). Select the column and use Data > Trim or Find & Replace to clean the values, then re-sort and reapply the subtotal.
  8. If you're using the SUBTOTAL function in a formula (rather than the Data tool), check its syntax: =SUBTOTAL(9, A2:A100) sums the range and ignores other subtotals; 9 is Sum, 1 is Average, 2 is Count. A common error is using 109 when you want hidden rows included, or 9 when you want them excluded — function codes 101–111 ignore rows hidden by filters and manually, while 1–11 ignore only filtered-out rows.

Common Mistakes

  • Skipping the sort — the number one cause of duplicate subtotal rows
  • Leaving blank rows or merged cells inside the data range, which breaks the automatic range detection
  • Trying to apply Subtotal inside a formatted Excel Table — the Data > Subtotal command is greyed out there; convert the table back to a range first via Table Design > Convert to Range
  • Subtotalling a column of text-formatted numbers and getting 0
  • Applying Subtotal to filtered data and misreading which rows are included

Tips

  • Save a copy of your file before running Remove All, just in case you had manual edits in the subtotal rows.
  • Use the outline buttons (1, 2, 3) on the left edge after applying subtotals to collapse and check your groups quickly.
  • If you need multiple group levels (e.g. totals per Region and per Product within Region), apply Subtotal a second time with a different "At each change in" column and untick "Replace current subtotals" so both levels stay.
  • For live dashboards, prefer the SUBTOTAL function or a PivotTable over the Subtotal tool — they update automatically when data changes.

Troubleshooting

  • The Data > Subtotal button is greyed out: you're inside an Excel Table. Click in the table, go to Table Design > Convert to Range, confirm, and try again.
  • Subtotal rows appear after every single row: your grouping column isn't sorted, or each value is unique. Re-sort, clean trailing spaces, and reapply.
  • Subtotals show 0 or blank: numbers are stored as text. Convert them as in Step 4, then reapply the subtotal.
  • Only part of the data gets subtotals: there's a blank row or column splitting the range. Delete it and rerun Data > Subtotal.
  • Everything looks scrambled after multiple attempts: open Data > Subtotal > Remove All, verify your raw data is intact, then follow the steps again in order — sort first, then subtotal.
  • Subtotal works but won't update: the Subtotal tool inserts static rows; it doesn't recalculate when data changes. Remove and reapply, or switch to a PivotTable for data that changes often.

Frequently Asked Questions

Why does Excel create a subtotal after every row?

Your data isn't sorted by the grouping column. Excel inserts a subtotal each time the value in that column changes, so scattered values mean dozens of subtotal rows. Sort first.

Why is my SUBTOTAL formula returning 0?

The referenced cells are text, not numbers. Convert them with Paste Special > Add or the warning-icon Convert to Number option, and the formula will calculate.

What's the difference between function codes 9 and 109 in SUBTOTAL?

Both sum the range, but 9 ignores only rows hidden by a filter, while 109 also ignores rows you hid manually. Neither includes other SUBTOTAL results in its range.

Can I use the Subtotal tool on an Excel Table?

No — the button is disabled inside tables. Convert the table to a range (Table Design > Convert to Range) or use a PivotTable instead.

How do I remove all subtotal rows at once?

Click in the data, open Data > Subtotal, and click Remove All. Your original data stays intact; only the inserted subtotal rows and the outline are deleted.