Share

The SUBTOTAL function in Excel is a powerful tool for performing calculations like sums, averages, and counts on a range of cells, with the unique ability to ignore rows hidden by filters. Mastering its use can significantly enhance your data analysis efficiency, especially when working with large, dynamic datasets.
The SUBTOTAL function is a versatile formula that allows you to apply different operations—such as SUM, AVERAGE, or COUNT—to a specified cell range. Its key advantage over standard functions is its behavior with filtered lists; it can be set to calculate only visible cells, automatically excluding any hidden rows. The function's syntax is =SUBTOTAL(function_num, ref1, [ref2], ...), where function_num is a code that determines the operation (e.g., 9 for SUM, 1 for AVERAGE), and ref1 is the primary cell range. This makes it indispensable for creating reports where data visibility changes frequently.
Writing a SUBTOTAL formula is a straightforward, three-step process that ensures accurate calculations on your data.
=SUBTOTAL(.109 instead of 9 ensures your SUM calculation adjusts when you apply a filter.=SUBTOTAL(109, B2:B100).This process allows you to quickly apply and change calculations without rebuilding formulas from scratch.
The SUBTOTAL function can reference 11 primary operations, each with two codes for handling hidden rows. The table below outlines the full list of available functions:
| Function Num (Includes Hidden Rows) | Function Num (Ignores Hidden Rows) | Operation |
|---|---|---|
| 1 | 101 | AVERAGE |
| 2 | 102 | COUNT (numbers only) |
| 3 | 103 | COUNTA (non-empty cells) |
| 4 | 104 | MAX |
| 5 | 105 | MIN |
| 6 | 106 | PRODUCT |
| 7 | 107 | STDEV (sample standard deviation) |
| 8 | 108 | STDEVP (population standard deviation) |
| 9 | 109 | SUM |
| 10 | 110 | VAR (sample variance) |
| 11 | 111 | VARP (population variance) |
For instance, if you need to find the average of a filtered list, you would use 101 as your function number. This flexibility is central to the function's utility.
Integrating the SUBTOTAL function into your workflow offers several distinct advantages for data management.
COUNT and COUNTA to identify blank cells quickly.To leverage the SUBTOTAL function effectively, always use the 101-111 series when working with filters to ensure calculations update correctly. It is the optimal tool for creating interactive and accurate reports in Excel.






