Subtotals in Google Sheets let you quickly sum, average, count, or apply other functions to groups of data—for example, total sales per region or average test score per class. The fastest way is to use the built-in Subtotal command, which automatically inserts subtotal rows and a grand total. You need your data organized in columns with headers, and the column you want to group by should be sorted. Here’s the step-by-step process.
What You’ll Need
- A Google account and a Google Sheets document with your data.
- Data arranged in a table with a header row (e.g., Region, Sales).
- The column you want to group by must be sorted (A→Z or Z→A) so that identical values are adjacent.
- No blank rows or columns within the data range.
Step-by-Step
- Open your Google Sheet in a web browser (Chrome, Firefox, Safari, etc.).
- Sort your data by the grouping column. Click the letter at the top of the column you want to group by (for example, column A for “Region”). Then go to Data > Sort sheet by column A (A to Z) or use the filter icon in the toolbar and choose sort. If you have multiple columns, select the entire data range first (Ctrl+A on Windows, Cmd+A on Mac) to avoid sorting only one column.
- Select the entire data range, including the header row. For example, if your data is in A1:C100, click A1, hold Shift, and click C100. Or click the top-left cell and press Ctrl+Shift+End (Windows) or Cmd+Shift+End (Mac).
- Go to the menu: Data > Subtotal. (In some versions, it might be under Data > Subtotal directly.)
- In the Subtotal dialog box, set the following:
- At each change in: Choose the column you sorted by (e.g., “Region”).
- Use function: Choose SUM (or COUNT, AVERAGE, MIN, MAX, etc.).
- Add subtotal to: Check the column(s) you want to calculate—typically numeric columns like “Sales” or “Amount”. Uncheck any columns you don’t need.
- Choose where to place the subtotals: Check “Summary below data” to place subtotal rows after each group (recommended). If you prefer above, uncheck it (but that’s less common).
- Click OK. Google Sheets will insert a subtotal row after each group, labeled with the group name and the function result. A grand total row appears at the very bottom.
- Review the results. For example, if you grouped by “Region” and summed “Sales”, you’ll see rows like “East Total” with the sum, and a final “Grand Total”.
- To remove subtotals, go to Data > Subtotal again and click Remove all.
Common Mistakes
- Not sorting the grouping column—if the data isn’t sorted, subtotals will appear multiple times for the same group, breaking the layout.
- Including blank rows or columns in the selected range—this can cause subtotals to be inserted for empty groups or the function to skip data.
- Selecting only part of the data—if you select only the numeric column, the subtotal rows won’t have the group labels, and the structure will be confusing.
- Forgetting to uncheck columns you don’t need—if you check a text column, the function (like SUM) will fail or return 0.
- Using the Subtotal command on a filtered range—subtotals ignore hidden rows, so if you have filters active, the results may be incomplete.
Tips
- Use the SUBTOTAL function manually if you need more control. For example, to sum visible rows only, use
=SUBTOTAL(9, B2:B10)(9 means SUM). This is useful when you want subtotals that ignore filtered-out rows. - After creating subtotals, you can collapse/expand groups using the outline numbers (1, 2, 3) on the left. Click “2” to see only subtotal rows and the grand total.
- If your data changes, you’ll need to re-run the Subtotal command (it doesn’t auto-update). Alternatively, use a pivot table for dynamic grouping.
- Format the subtotal rows (bold, background color) to make them stand out. You can select them manually or use conditional formatting based on the label text.
- For multiple grouping levels, run the Subtotal command twice—first on the outer group, then on the inner group while the outer subtotals are present. But be careful: the second run may overwrite the first. A pivot table is usually better for multi-level grouping.
Troubleshooting
- Subtotal option is grayed out: Make sure you have selected a range of cells. If you’re on a merged cell or a chart, it won’t work. Also, check that the sheet isn’t protected (Review > Protect sheets).
- Subtotals are wrong (e.g., sum is 0 or #VALUE!): This usually means you included a text column in the “Add subtotal to” list. Uncheck any non-numeric columns. Also verify that the numeric column doesn’t contain text-formatted numbers—select the column, go to Format > Number > Number.
- Subtotals appear for every row: This happens when the grouping column isn’t sorted, or there are hidden characters/spaces making values appear different. Use Data > Sort to sort properly. Also check for trailing spaces—use Find and Replace (Ctrl+H) to remove them.
- Grand total is missing: If you don’t see a grand total, you might have selected “Summary above data” or the range didn’t include all rows. Re-run the command and ensure “Summary below data” is checked.
- After removing subtotals, my original data is gone: The Subtotal command inserts rows, but it doesn’t delete your original data. If you used “Remove all”, the subtotal rows are removed, and your original data remains. If you accidentally deleted rows, use Ctrl+Z (Cmd+Z on Mac) to undo.
- Subtotals don’t update when I change numbers: The Subtotal command creates static values, not formulas. To make them dynamic, use the SUBTOTAL function manually or a pivot table. You can also re-run the command after editing.
Frequently Asked Questions
1. Can I use the Subtotal command on multiple columns at once?
Yes. In the “Add subtotal to” list, check multiple numeric columns. Each will get its own subtotal row with the chosen function applied.
2. Does the Subtotal command work with filters?
The command ignores hidden rows. If you want subtotals that respect filters, use the SUBTOTAL function (e.g., =SUBTOTAL(9, B2:B10)) instead of the menu command.
3. How do I subtotal by two columns (e.g., Region and then Product)?
Sort by both columns (first Region, then Product). Run Subtotal for Region, then run it again for Product, but in the second run, uncheck “Replace current subtotals” if available (in some versions). However, this can get messy; a pivot table is recommended for multi-level grouping.
4. Why is my average subtotal showing a decimal when I expected a whole number?
That’s normal—averages are often decimals. To round, use the ROUND function in a helper column, or format the cells to show fewer decimal places (Format > Number > Number).
5. Can I subtotal without sorting?
No, the Subtotal command requires the grouping column to be sorted so that identical values are adjacent. If you don’t sort, you’ll get multiple subtotal rows for the same group.
6. Is there a way to subtotal in Google Sheets on mobile?
The mobile app has limited features. The Subtotal command is only available in the web browser. On mobile, you can use the SUBTOTAL function manually, but it’s easier to use a desktop browser.
Related
- Windows Ctrl Shortcuts: The Complete List
- Speed and Intersection Safety Cameras: How They Work
- Traffic Light Reaction Time: How Long It Takes
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Compressing Images in PowerPoint: Steps and SettingsIn PowerPoint for Microsoft 365 on Windows, select a picture, go to Picture Format > Compress Pictures, choose…
- Excel Loan Amortization Template: How to Build OneYes, you can build a fully functional loan amortization schedule in Excel using the PMT, IPMT, and PPMT…
- Export Notion Table to Excel: 3 WaysYes, you can export a Notion table to Excel. The simplest method is to open the table’s menu…
- How to Share a Private Calendar in OutlookTo share a private calendar in Outlook, open Calendar, choose Share Calendar, enter the recipient’s email address, select…
- How to Select All in Computer: Windows, Mac, & MoreSelecting all text, files, or items at once is one of the fastest ways to work on a…
- Google Sheets GOOGLEFINANCE: Prices, History, and LimitsYes. Google Sheets can retrieve financial information with the GOOGLEFINANCE function: enter a ticker and, optionally, a data…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.