

On its own, the SUBTOTAL function is a quiet powerhouse. In both Excel and Google Sheets it lets you calculate sums, averages, counts, and more that automatically respond to filters and hidden rows. Instead of rewriting SUM or AVERAGE every time you slice your data, you call SUBTOTAL with a function number, like 9 or 109 for SUM, and a range such as A2:A500. Excel even layers this into its Subtotal command so you can insert group-level totals and a grand total in a few clicks.But in a real business, you do not run SUBTOTAL once. You repeat the same ritual every week: export CRM data, paste it into Excel, clean the columns, set up filters, add SUBTOTAL formulas, double check that hidden rows are treated correctly, and then copy charts into a slide deck. That is where an AI computer agent changes the story. Instead of humans re-building the same filtered views and subtotals, you hand the workflow to an agent that opens the sheet, refreshes data, applies the right SUBTOTAL function numbers, validates results against spot checks, and ships your reports while you are on sales calls. Delegating this to an agent turns a fragile manual habit into a dependable background process.
### 1. Manual ways to use SUBTOTAL in Excel and Google SheetsBefore you automate, you need to be confident with the basics. SUBTOTAL works the same conceptually in both tools:- Syntax: SUBTOTAL(function_num, ref1, [ref2], ...)- function_num chooses the operation and how hidden rows behave. - 1–11 include manually hidden rows - 101–111 ignore manually hidden rowsOfficial references:- Excel SUBTOTAL: https://support.microsoft.com/en-us/office/subtotal-function-7b027003-f060-4ade-9040-e478765b9939- Insert Subtotals in Excel lists: https://support.microsoft.com/en-us/office/insert-subtotals-in-a-list-of-data-in-a-worksheet-7881d256-b4fa-4f81-b71e-b0a3d4a52b3a- Google Sheets SUBTOTAL: https://support.google.com/docs/answer/3093649?hl=en#### 1.1 Simple filtered total in Excel1) Put your data in a clean column, say Sales in B2:B500.2) Click any cell inside the data and apply a filter via Data > Filter.3) In a summary cell, enter: - =SUBTOTAL(109, B2:B500) - 109 means SUM while ignoring manually hidden rows.4) Filter your list by region, owner, or product. The SUBTOTAL result will update to include only visible rows.#### 1.2 Grouped subtotals with the Excel Subtotal command1) Sort your data by the grouping column, for example Region.2) Go to Data > Subtotal.3) In At each change in, choose Region.4) In Use function, choose Sum (or Average, Count, etc.).5) In Add subtotal to, tick Sales.6) Click OK. Excel inserts subtotal rows and a grand total using SUBTOTAL formulas automatically.7) Use the outline buttons on the left (1, 2, 3) to collapse or expand detail.#### 1.3 Manual SUBTOTAL in Google Sheets with filters1) Lay out your data, for example Amount in C2:C1000.2) Select the header row and choose Data > Create a filter.3) In a summary cell, enter: - =SUBTOTAL(109, C2:C1000)4) Filter by campaign, channel, or owner. SUBTOTAL recalculates to include only visible rows.#### 1.4 Using different function numbers for analysisIn both Excel and Sheets you can swap function_num for different views:- =SUBTOTAL(101, C2:C1000) for AVERAGE of visible rows- =SUBTOTAL(102, A2:A1000) for COUNT of visible numeric entries- =SUBTOTAL(104, C2:C1000) to get MAX of visible valuesThis lets a marketer or agency owner answer questions like: what is the average deal size of visible deals, or the maximum spend in the filtered period, without touching the underlying data.#### 1.5 Avoiding double countingSUBTOTAL ignores other SUBTOTAL results inside its refs. That means you can safely nest group subtotals and a grand total without inflating your numbers.### 2. No-code automation methodsOnce your formulas are solid, you can reduce repetitive clicks using built-in or low-code tools.#### 2.1 Excel Tables with Total Row1) Select your range and press Ctrl+T to create an Excel Table.2) Check My table has headers and click OK.3) With the table selected, enable the Total Row from Table Design > Total Row.4) In the Total row cell under Sales, pick Sum from the dropdown. Excel inserts SUBTOTAL(109, [Sales]) behind the scenes.5) Whenever you filter the table, the total automatically reflects visible rows only.Pros: Zero formula writing once set up, robust for non-technical users.Cons: Less flexible for multi-sheet or cross-file reporting.#### 2.2 Google Sheets filter views plus SUBTOTAL1) Set up your master sheet with a SUBTOTAL cell, for example: - =SUBTOTAL(109, C2:C10000)2) Use Data > Filter views > Create new filter view.3) Configure different filter views, such as By owner, High value deals, or Q4 pipeline.4) Save each view with a descriptive name. The same SUBTOTAL formula serves all of them.Pros: Non-destructive filters, perfect for teams sharing the same sheet.Cons: Still requires you to open the sheet, switch views, and export data manually.#### 2.3 No-code integrations (Zapier, Make, Power Automate)You can have tools like Zapier or Microsoft Power Automate push fresh data into your Sheets or Excel files where SUBTOTAL is already configured:- Example for Google Sheets and Zapier: 1) Trigger: New deal in your CRM. 2) Action: Append a row into your Google Sheet deals log. 3) Your existing SUBTOTAL cells update automatically for dashboards.- Example for Excel and Power Automate: 1) Trigger: New row in an Excel file stored in OneDrive or SharePoint. 2) Action: Post a summary of the updated SUBTOTAL to Teams or email.Pros: Keeps data live without manual copy paste.Cons: Integrations require setup, and logic still lives in scattered spreadsheets.### 3. Scaling with AI agents (Simular-style workflows)When your team is running dozens of reports across clients or business units, manual and no-code methods still leave you clicking. An AI computer agent, like one built on Simular Pro, can operate your desktop, browser, Excel, and Google Sheets as if it were a trained analyst.#### 3.1 Agent-driven reporting ritualImagine your Monday pipeline ritual:1) The agent opens your CRM, exports data, and saves it.2) It launches Excel, loads the correct workbook, and pastes or imports new rows into the right sheet.3) It verifies that SUBTOTAL formulas exist in key summary cells, and if missing, it writes the right function, such as =SUBTOTAL(109, SalesColumnRange).4) It applies or updates filters, checks totals against last week, and flags anomalies.5) Finally, it exports PDFs or PowerPoint screenshots and drops them into a shared drive or emails them to your team.Pros: Fully hands-off, consistent, and transparent; every agent action can be inspected and adjusted.Cons: Requires initial design and testing of the workflow, and runs best on stable report formats.#### 3.2 Multi-client agency dashboards at scaleFor agencies juggling many client workbooks:1) Store a standard Google Sheets or Excel template where all SUBTOTAL logic is baked in.2) The AI agent duplicates the template per client, renames files, and connects them to each client data source (CSV, exports, APIs via browser).3) On a schedule, the agent refreshes data, lets formulas recalc, checks key metrics against thresholds, and posts client-ready summaries.Pros: Massive leverage for account managers; easy to roll out new clients.Cons: Template changes must be coordinated so the agent scripts stay in sync.#### 3.3 Hybrid: human plus agent collaborationYou might prefer to keep humans in the loop:1) The agent prepares the data and SUBTOTAL-based views.2) A sales leader quickly reviews numbers, adjusts filters, or scenarios.3) The agent then handles publishing, archiving, and notifying stakeholders.Pros: Best of both worlds: human judgment with machine execution.Cons: Still requires lightweight review time from your team.As your reporting load grows, these AI agent patterns turn SUBTOTAL from a handy formula into a backbone of reliable, automated insight delivery across Excel and Google Sheets.
Choosing the correct function_num is the key to using SUBTOTAL effectively. The first decision is what calculation you need: AVERAGE, COUNT, SUM, MAX, and so on. The second decision is whether to include manually hidden rows.In both Excel and Google Sheets, function numbers 1–11 include manually hidden rows, and 101–111 ignore them. For example:- 9 or 109 = SUM- 1 or 101 = AVERAGE- 2 or 102 = COUNT (numeric)- 3 or 103 = COUNTA (non-empty)- 4 or 104 = MAX, 5 or 105 = MINIf you are using filters to slice data, filtered-out rows are always ignored, regardless of the number range. For dynamic dashboards where users sometimes hide rows, use the 100-series (like 109) so your totals only consider visible data. In Excel, you can see the full list and examples in the official docs: https://support.microsoft.com/en-us/office/subtotal-function-7b027003-f060-4ade-9040-e478765b9939
To subtotal grouped data in Excel without hand-writing every formula, use the built-in Subtotal command, which inserts SUBTOTAL formulas for you.Step by step:1) Sort your data by the column you want to group on, such as Region or Salesperson (Data > Sort A to Z or Z to A).2) Click any cell in the data range.3) Go to Data > Subtotal.4) In At each change in, choose the grouping column (for example, Region).5) In Use function, pick the summary you need, such as Sum or Average.6) In Add subtotal to, tick the numeric columns to summarise, like Sales.7) Click OK. Excel inserts subtotal rows after each group change and a grand total at the bottom, all implemented with SUBTOTAL formulas.You can then collapse or expand detail using the outline buttons on the left. The full guide from Microsoft is here: https://support.microsoft.com/en-us/office/insert-subtotals-in-a-list-of-data-in-a-worksheet-7881d256-b4fa-4f81-b71e-b0a3d4a52b3a
In Google Sheets, SUBTOTAL is designed to work hand-in-hand with filters. It automatically ignores rows hidden by a filter, so you can build interactive reports without recalculating formulas.Here is how to set it up:1) Arrange your data with headers in row 1 and values below, for example amounts in C2:C1000.2) Select the header row and choose Data > Create a filter.3) In a summary cell, enter a formula like =SUBTOTAL(109, C2:C1000). The 109 code tells Sheets to SUM while ignoring manually hidden rows.4) Click the filter icons in your header to filter by campaign, status, or owner. The SUBTOTAL result updates instantly to reflect only visible rows.You can switch to a different function by changing 109 to 101 for AVERAGE, 102 for COUNT, 104 for MAX, etc. Google’s official reference for SUBTOTAL, including all function numbers, is here: https://support.google.com/docs/answer/3093649?hl=en
SUBTOTAL behaves differently depending on how rows are hidden and which function number you use. Understanding this logic prevents nasty surprises in your reports.There are three key rules:1) Filtered-out rows are always ignored. If you hide rows via a filter in Excel or Sheets, SUBTOTAL will not include them in its calculation, no matter which function_num you use.2) Manually hidden rows are optional. If you right-click a row and choose Hide, then: - Function numbers 1–11 will include those hidden rows. - Function numbers 101–111 will exclude those hidden rows.3) SUBTOTAL is column-oriented. It is designed for vertical ranges like B2:B500. Hiding columns in a horizontal range may not behave as you expect, especially in Excel.If you see unexpected numbers, check whether rows are filtered or manually hidden, and confirm that you chose the right function range (1–11 vs 101–111). The Microsoft docs explain these nuances in detail: https://support.microsoft.com/en-us/office/subtotal-function-7b027003-f060-4ade-9040-e478765b9939
To automate recurring SUBTOTAL-based reports at scale, combine solid spreadsheet design with automation layers.1) Start with a clean template in Excel or Google Sheets: - Put raw data on a dedicated Data sheet. - Use SUBTOTAL formulas on a Summary sheet, referencing entire columns or defined ranges. - Rely on 100-series function numbers (like 109) so hidden rows do not skew totals.2) Connect data sources: - For Sheets, use tools like Zapier or native connectors to append new rows whenever leads or transactions arrive. - For Excel, place files in OneDrive or SharePoint and use Power Automate to refresh and notify stakeholders.3) Introduce an AI computer agent (for example, built on Simular Pro): - The agent opens your CRM, exports data, pastes into the template, checks that SUBTOTAL results match expectations, then distributes reports.4) Iterate and monitor: - Spot-check a few records each cycle. - Refine filters, ranges, and agent instructions as your business evolves.This layered approach lets you run many client or department reports reliably, without humans rebuilding the same SUBTOTAL workflows every week.