Remove Subtotal from Formula? Here’s How

Formulas & functions · Updated November 22, 2026

Yes, you can remove a subtotal from a formula, but the method depends on what you mean by “subtotal”: if you want a formula that ignores other SUBTOTAL function results (for example, when a SUBTOTAL is inside a range), use the AGGREGATE function; if you want to remove a subtotal row from a SUM or similar calculation, simply exclude that row from the range or use a SUMIF with a criteria. Below I explain the exact steps for each interpretation, with Excel formulas you can copy.

What Does “Subtotal” Mean in Excel?

In Excel, “subtotal” can refer to two different things: the SUBTOTAL function (which returns a subtotal like SUM or AVERAGE for a list, and is often used with filtered data) or a subtotal row that you insert manually (for example, a row that sums the numbers above it). When people ask to “remove subtotal from formula,” they usually mean one of these:

  • They have a range that includes a cell containing a SUBTOTAL function, and they want their formula to ignore that cell.
  • They have a data range with subtotal rows (like “Total” rows) and they want a formula that sums only the detail rows, not the subtotals.
  • They want to remove the subtotal feature from a worksheet (i.e., delete the subtotal rows).

I’ll cover each scenario.

Scenario 1: Formula Ignoring a SUBTOTAL Function Cell

Suppose you have a list of numbers in A2:A10, and A10 contains =SUBTOTAL(9,A2:A9) (the sum of A2:A9). If you write =SUM(A2:A10), Excel will double-count because A10 already contains a sum. To ignore the subtotal cell, you have two options:

  • Change the range to exclude the subtotal row: =SUM(A2:A9)
  • Use AGGREGATE to ignore errors and hidden rows, but AGGREGATE doesn’t automatically skip SUBTOTAL cells unless you use a function number that ignores them? Actually, AGGREGATE does not skip SUBTOTAL cells; it skips hidden rows and errors. So the best way is to exclude the subtotal row from the range.

If you need a dynamic formula that automatically excludes any SUBTOTAL cells within a range, you can use a SUMPRODUCT with ISNUMBER and NOT(ISFORMULA) but that’s complex. A simpler approach: use SUMIF with a criteria that excludes the subtotal row, for example if the subtotal row has a label in column B like “Total”, then =SUMIF(B2:B10,"<>Total",A2:A10).

Scenario 2: Removing Subtotal Rows from a Calculation

If your data has subtotal rows (e.g., from Data > Subtotal), and you want a formula that sums only the detail rows, use SUMIF with a criteria that identifies subtotal rows. For example, if column A has region names and column B has sales, and subtotal rows have “Total” in column A, then:

Assuming data in A1:B100, with subtotal rows having “Total” in column A, the formula =SUMIF(A2:A100,"<>Total",B2:B100) sums only the non-Total rows.

Alternatively, you can use a SUMPRODUCT with ISNUMBER(SEARCH(“Total”,A2:A100)) but SUMIF is simpler.

If you want to remove the subtotal rows entirely (delete them), go to Data > Subtotal and click Remove All. That deletes the subtotal rows and restores the original data.

Scenario 3: Removing the Subtotal Feature (Data > Subtotal)

If you used Excel’s built-in Subtotal feature (Data > Subtotal), and you want to remove the subtotals and outline symbols, follow these steps:

  1. Select any cell in the data range.
  2. Go to the Data tab.
  3. Click Subtotal (in the Outline group).
  4. Click Remove All.

This removes all subtotal rows and the outline symbols. Note that this action cannot be undone with Ctrl+Z? Actually it can be undone, but it’s a good practice to save a copy first.

How to Use AGGREGATE to Ignore Subtotal Cells

Some users think AGGREGATE can skip subtotal cells, but it doesn’t. AGGREGATE ignores errors and hidden rows, not other SUBTOTAL functions. For example, =AGGREGATE(9,6,A2:A10) sums A2:A10 ignoring errors and hidden rows, but if A10 contains a SUBTOTAL, it will still be included. So the only reliable way to exclude a subtotal cell is to exclude it from the range or use a conditional sum.

Common Misconception: SUBTOTAL vs. SUM

A frequent question is: “Why does my SUM include subtotals?” The answer is that SUBTOTAL is just a number in a cell, and SUM will add it like any other number. There’s no built-in way to make SUM ignore SUBTOTAL cells automatically. If you want to sum only visible cells (e.g., after filtering), use SUBTOTAL(9, range) instead of SUM. But that’s a different problem.

Frequently Asked Questions

How do I remove subtotals from a PivotTable?

In a PivotTable, right-click a field that has subtotals, choose Field Settings, then under Subtotals & Filters, select None. This removes the subtotal rows from that field. Repeat for each field if needed.

Can I use a formula to sum a range that includes subtotal rows without double counting?

Yes, use SUMIF with a criteria that excludes the subtotal rows. For example, if subtotal rows have a label like “Total” in column A, use =SUMIF(A:A,"<>Total",B:B). This works even if the subtotal rows are not contiguous.

Why does my SUBTOTAL formula return an error when I try to remove it?

If you try to delete a subtotal row that is part of a SUBTOTAL formula, you might get a #REF! error if the formula refers to that row. To avoid this, remove the subtotals using Data > Subtotal > Remove All, which adjusts the formulas correctly.

Is there a way to make a formula ignore hidden rows (like filtered rows) and subtotals at the same time?

Yes, use AGGREGATE with function number 9 (SUM) and option 5 (ignore hidden rows), but it will still include subtotal cells. To ignore both, you’d need to exclude subtotal rows manually or use a helper column that marks subtotal rows and then use SUMIFS with that helper column.

What’s the difference between SUBTOTAL and AGGREGATE?

SUBTOTAL can ignore hidden rows (when using function numbers 101-111) but not errors. AGGREGATE can ignore both hidden rows and errors, and offers more functions. Neither automatically skips other SUBTOTAL cells.

Final Tips for Clean Formulas

  • Always check your data range before writing a formula; if you include a subtotal row, you’ll get a wrong result.
  • Use Excel Tables (Insert > Table) to make ranges dynamic; then you can use structured references that often exclude subtotal rows if they are not part of the table.
  • If you frequently need to exclude subtotals, consider using a helper column with a flag like “Subtotal” and then use SUMIFS.

Remember, the simplest way to remove a subtotal from a formula is to exclude the subtotal row from the range. If that’s not possible, use a conditional sum like SUMIF. For the built-in Subtotal feature, just click Remove All. Always save a copy of your workbook before making major changes, as some operations cannot be undone.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.