Smart Systems for Home

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

How to Apply Subtotal in Excel: Step-by-Step Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To apply subtotals in Excel, first make sure your data is in a clean table with a header row and no blank rows. Then select any cell in the range, go to the Data tab, click Subtotal, choose the column to group by and the function to use (Sum, Count, Average, etc.), pick the column(s) to subtotal, and click OK. Excel inserts subtotal rows and a grand total, and adds outline buttons so you can collapse or expand groups.

What You'll Need

  • Excel 2016 or later (Windows or Mac) — the Subtotal feature is also in Microsoft 365. Menu labels can differ slightly by version, device, or region.
  • Data arranged in columns with a single header row, no merged cells, and no completely blank rows inside the range.
  • At least one column to group by (for example, Region or Category) and at least one numeric column to sum or average.

Step-by-Step

  1. Prepare the data. Put each field in its own column, with headers in row 1. Remove blank rows and unmerge any merged cells. If your data is not already sorted by the group column, sort it first: select the range, go to Data > Sort, choose the group column in “Sort by,” and click OK. Subtotal works best when rows for the same group are together.
  2. Select the data range. Click any cell inside the table. Excel usually detects the whole range automatically. If it does not, select the entire range including headers before opening the dialog.
  3. Open the Subtotal dialog. On the Data tab, in the Outline group, click Subtotal. (On Mac Excel, the path is also Data > Subtotal.)
  4. Choose the group column. In “At each change in,” select the column you sorted by, such as Region. This is the column Excel watches for changes to insert a subtotal row.
  5. Pick the function. In “Use function,” choose Sum for totals, Count for counting entries, Average for means, or another option such as Max or Min.
  6. Select the columns to subtotal. Under “Add subtotal to,” tick the numeric column(s) you want calculated, such as Sales or Units. Untick any column you do not want subtotaled.
  7. Set replacement and page break options if needed. Leave “Replace current subtotals” ticked if you are redoing subtotals. Tick “Page break between groups” only if you plan to print each group on a separate page. Leave “Summary below data” ticked to place subtotals under each group.
  8. Click OK. Excel inserts a subtotal row after each group and a grand total at the bottom. Outline buttons (1, 2, 3) appear at the left; use 2 to show only subtotals and 3 to show everything.
  9. Collapse or expand groups. Click the minus/plus signs beside each group, or use the outline level buttons at the top-left of the sheet. Level 1 shows the grand total only, level 2 shows group subtotals, and level 3 shows all rows.
  10. Remove subtotals when done. Open Data > Subtotal again and click Remove All. This deletes the subtotal rows and outline, leaving your original data intact.

Common Mistakes

  • Forgetting to sort first. If rows for the same group are scattered, Excel creates a subtotal every time the group value changes, producing many small subtotals instead of one per group.
  • Including blank rows or merged cells. Blank rows break the range into separate blocks, and merged cells can stop Excel from detecting the correct columns.
  • Subtotaling the wrong column. Ticking a text column with Sum produces zeros. Only tick numeric columns for Sum or Average.
  • Running Subtotal twice without replacing. If “Replace current subtotals” is unticked, Excel adds a second layer of subtotals on top of the first, doubling the rows.
  • Using Subtotal on a formatted Excel Table. The Subtotal command is designed for a normal range. If your data is an Excel Table (created with Insert > Table), convert it to a range first (Table Design > Convert to Range) or use a PivotTable instead.

Tips

  • Use a PivotTable when you need flexible grouping or frequent changes; Subtotal is best for a quick, static summary of sorted data.
  • After applying subtotals, copy the visible subtotal rows only by using Home > Find & Select > Go to Special > Visible cells only before copying.
  • To subtotal more than one level (for example, Region then Product), run Subtotal once for the outer group, then run it again for the inner group with “Replace current subtotals” unticked.
  • Keep a backup copy of the sheet before applying subtotals if the data is important; Remove All restores the original rows but not any manual edits made after subtotaling.

Troubleshooting

  • Subtotal is greyed out. This usually means the active cell is inside an Excel Table or a protected sheet. Convert the table to a range, or unprotect the sheet via Review > Unprotect Sheet (you will need the password).
  • No subtotals appear. Check that the group column contains repeated values and that the data is sorted by that column. Also confirm at least one column is ticked under “Add subtotal to.”
  • Subtotals appear after every row. The group column values are unique per row or the data is not sorted. Sort by the group column and run Subtotal again with “Replace current subtotals” ticked.
  • Grand total is wrong. Hidden rows are excluded from Subtotal calculations by default. If rows are filtered out, clear the filter or use SUBTOTAL formulas with the appropriate function number if you need to include or exclude hidden rows deliberately.
  • Outline buttons disappeared. Go to File > Options > Advanced (Windows) or Excel > Preferences (Mac) and ensure “Show outline symbols if an outline is applied” is ticked. On Mac, look under the View settings for outline symbols.

Frequently Asked Questions

Can I subtotal more than one column at once?

Yes. In the Subtotal dialog, tick multiple numeric columns under “Add subtotal to.” Excel adds a subtotal for each selected column in the same subtotal row.

Does Subtotal work on filtered data?

The Subtotal command inserts rows into the range, so it is best used on unfiltered data. For filtered lists, use the SUBTOTAL function in a formula instead, which can ignore hidden rows.

How do I remove subtotals without losing my data?

Open Data > Subtotal and click Remove All. This deletes the subtotal rows and outline, leaving the original rows. Any manual edits you made after subtotaling remain.

Why does Subtotal show zero for my column?

The column likely contains text or numbers stored as text. Convert text to numbers (for example with Text to Columns or by multiplying by 1) before subtotaling.

Can I use Subtotal on a Mac?

Yes. The feature is on the Data tab in Excel for Mac, though dialog wording and outline button placement can differ slightly from Windows.

What is the difference between Subtotal and a PivotTable?

Subtotal inserts static summary rows into your sheet based on sorted groups. A PivotTable builds a separate interactive summary you can rearrange without changing the source data.