SUBTOTAL Function in Microsoft Excel: Syntax, Examples & Compatibility
Learn how to summarize a filtered list while controlling treatment of hidden rows in Microsoft Excel. Includes syntax, two verified-by-reasoning results, troubleshooting and portability notes.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in Microsoft Excel. How formula examples are checked
Quick answer: summarize a filtered list while controlling treatment of hidden rows in Microsoft Excel. The reproducible examples below use explicit values so the formula’s meaning is testable without a large workbook.
Evidence: The function name and syntax are documented in the linked vendor function reference. Expected outputs were independently reasoned or checked outside the application. These are not native Microsoft Excel test results. A guide being published here does not certify every software release or file-import scenario.
Syntax and arguments
=SUBTOTAL(function_num, ref1, [ref2], ...)
Function code 9 requests SUM and code 1 requests AVERAGE. The 100-series counterparts can additionally exclude manually hidden rows.
Best use case: Summarize a filtered list while controlling treatment of hidden rows.
Set up the example sheet
Enter 10, 20, 30, and 40 in B2:B5. Leave all rows visible for both baseline checks, then try filtering out a row to study the result.
Enter the formula in an unused cell. For a formula returning several values, leave an unobstructed area where those values can expand. These formulas use comma argument separators in a typical English-language locale; commas or semicolons inside quoted text are data, not argument separators. Adapt the separator if your regional settings require it.
Worked example 1: SUBTOTAL with known input
=SUBTOTAL(9,B2:B5)
Expected output: 100.
Sum over four visible rows is 10 + 20 + 30 + 40.
Worked example 2: a second SUBTOTAL case
=SUBTOTAL(1,B2:B5)
Expected output: 25.
Average over the same four values is 100 divided by 4.
Compare both results before replacing literal values or short sample ranges with your own workbook data. For a spilling formula, compare every output cell, not only the top-left result.
Practical advice and troubleshooting
When this formula helps: SUBTOTAL is intended for filtered or collapsible reports. SUM is simpler when hidden-row behavior must not affect a total.
Important edge case: Codes 1–11 differ from 101–111 in manually hidden-row handling, and nested SUBTOTAL cells require special care.
If the result differs, first verify the text-versus-number types of the input cells, the argument separators for your locale, and the range size. For dynamic arrays, inspect occupied cells in the output area. An error that looks like a missing function may reflect a software version rather than incorrect data.
Compatibility and version considerations
This is a cross-program compatibility hot spot because filter visibility and manually hidden rows do not always have the same effect.
Check your installed release for availability and dynamic-array support.
Function availability and parameter behavior must be judged for the specific application and release; a function documented in one spreadsheet does not automatically work in another.
Related guides and official documentation
-
Microsoft Excel documentation for SUBTOTAL — function syntax and current vendor information.
Editorial verification: Vendor catalogue referenced as of 2026-10-12. The two example outputs are independently reasoned; no native application run, screenshot, or version-specific output is claimed. Review the editorial testing standards if you require stronger proof before importing a workbook.