Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Remove Subtotals in Google Sheets With a Formula

· 6 min read · Home Tech

In this article
  1. First identify what “subtotal” means
  2. Filter out rows with a subtotal label
  3. Exclude subtotals from a sum
  4. Remove repeated group totals
  5. Pivot table subtotals and SUBTOTAL formulas
  6. Common issues and safe workflow
  7. Frequently Asked Questions

To remove subtotal rows from a Google Sheets list with a formula, use =FILTER(A2:B, B2:B<>"Subtotal") when column B contains the label “Subtotal”; it returns the other rows in a separate range. If you mean removing subtotal values from a calculation rather than hiding subtotal rows, the right formula depends on how those values are identified.

First identify what “subtotal” means

Google Sheets does not have a single formula command that detects and removes every kind of subtotal. A subtotal might be a row labeled “Subtotal,” a repeated group total, a value produced by the SUBTOTAL function, or a subtotal displayed by a pivot table. These cases need different solutions.

The examples below assume a source table with headers in row 1, labels in column A, and amounts in column B. Formulas that spill results should go in an empty area, with enough blank rows and columns for the output. They create a filtered view; they do not delete or alter the original data.

Filter out rows with a subtotal label

If subtotal rows have a consistent text label, FILTER is usually the simplest option. With descriptions in A2:A and amounts in B2:B, put this formula in an empty cell:

=FILTER(A2:B, B2:B<>"Subtotal")

This example assumes the word “Subtotal” appears in column B. It returns each row for which column B is not exactly “Subtotal,” excluding the header because the ranges start at row 2. Change B to the column that holds the label. If the subtotal text is in column A, use:

=FILTER(A2:B, A2:A<>"Subtotal")

In actual formulas, type the less-than and greater-than symbols as <>; the HTML displays them escaped so they appear correctly in a webpage. If every row is excluded, FILTER returns an error because it found no matches. You can show a friendlier message with:

=IFNA(FILTER(A2:B, A2:A<>"Subtotal"), "No detail rows")

This assumes the label is in A and includes the same two-column output. It returns the filtered rows, or “No detail rows” if none qualify. The formula excludes only an exact match. For labels such as “January Subtotal,” use a condition that tests whether the cell contains the word:

=FILTER(A2:B, NOT(REGEXMATCH(A2:A, "(?i)subtotal")))

This version assumes subtotal descriptions are in A. It removes any row whose column A text contains “subtotal,” regardless of capitalization. Avoid it if valid detail descriptions might also contain that word.

Exclude subtotals from a sum

If you want a total that ignores rows labeled “Subtotal,” use SUMIF or SUMIFS instead of filtering the visible table. With labels in A2:A and amounts in B2:B, the formula is:

=SUMIF(A2:A, "<>Subtotal", B2:B)

It adds amounts whose corresponding label is not exactly “Subtotal.” For example, if the detail amounts are 12, 8, and 5 and the subtotal row contains 25, the result is 25—not 50. This is useful when subtotal rows repeat values already represented by the detail lines.

For labels that contain extra text, use a wildcard criterion. With the same column layout, this formula excludes any label containing “Subtotal”:

=SUMIF(A2:A, "<>*Subtotal*", B2:B)

Wildcards can also exclude legitimate descriptions that happen to contain that word. If possible, keep a dedicated row-type column with values such as “Detail” and “Subtotal”; a clear category is safer to maintain than guessing from descriptions.

Remove repeated group totals

Sometimes subtotal rows are not labeled consistently, but their amounts duplicate the sum of the detail rows above. A formula cannot reliably infer that a number is a subtotal just because it matches other numbers. The dependable approach is to add a helper column that explicitly marks each row’s type, then filter or sum only detail rows.

For example, if column C contains “Detail” or “Subtotal,” and the data to return is in A:B, use:

=FILTER(A2:B, C2:C="Detail")

For a total of detail amounts in B, use:

=SUMIF(C2:C, "Detail", B2:B)

These approaches make the rule visible and easy to audit. If the source is imported or generated by another system, consider fixing the source data or adding the row-type field during import rather than relying on a fragile formula based on position or amount.

Pivot table subtotals and SUBTOTAL formulas

Pivot-table subtotals are controlled by the pivot table, not removed from its source data by a filtering formula. Click the pivot table to open the pivot table editor, then inspect the relevant row or column field and turn off Show totals. The exact options depend on the pivot table’s fields and layout. This changes the pivot table display, not the underlying records.

The SUBTOTAL function is different: it calculates a result over a range and can ignore rows hidden by filtering. It does not label a row as a subtotal or automatically remove other subtotal rows from your dataset. If a source table already contains group totals and you apply a sum to all its rows, those totals may be counted again. Filter out the subtotal records first or sum a detail-only range.

Common issues and safe workflow

  • Keep the source intact: Put a formula-generated result in another area or on another sheet. A formula does not delete the original subtotal rows.
  • Check the criterion column: A formula looking in the wrong column may keep all subtotal rows or remove unrelated records.
  • Match the label carefully: Exact comparisons do not match extra spaces or longer phrases. Clean inconsistent labels or use a deliberate text-matching rule.
  • Allow room for the output: A spilled result cannot expand into occupied cells. Move the formula or clear the destination area if Sheets reports that it cannot expand.
  • Check blank rows and ranges: Open-ended ranges such as A2:B are convenient for growing lists, but make sure the criteria range and output range cover corresponding rows.

When the result looks right, you can copy the filtered output and use Edit > Paste special > Values only to make a static copy. Verify it before replacing or deleting source data; formulas and pasted values have different behavior as the source changes.

Frequently Asked Questions

Can Google Sheets automatically remove subtotal rows?
Not with one universal command. Use FILTER when rows have a reliable label, adjust the pivot table’s totals setting for pivot subtotals, or mark detail rows with a helper column.

Does FILTER delete the subtotal rows?
No. It returns matching rows in a separate output range and leaves the source unchanged. Delete source rows manually only after checking that the filtered result is complete and correct.

How do I sum a column without its subtotal rows?
Use SUMIF with a criterion that excludes the subtotal label, or sum rows marked “Detail” in a row-type column. Confirm that the criterion matches the labels in your sheet.

How do I remove subtotals from a pivot table?
Select the pivot table and turn off Show totals for the applicable field in the pivot table editor. A formula applied to the source data does not control the pivot table’s display settings.

Why does my FILTER formula show an error?
It may have found no rows that meet the condition, or its output area may be blocked by existing content. Check the label and ranges, then clear space for the result. IFNA can provide a custom message when there are no matches.