Excel Subtotal 9 Shortcut and How to Use It
In this article
To use the Subtotal 9 function in Excel, you enter the formula =SUBTOTAL(9, [range]). While there is no single-key keyboard shortcut to generate this specific formula, you can use Alt + = (AutoSum) as a starting point, or use the SUBTOTAL function to ensure your sums only include visible rows after a filter is applied. The number "9" is the function index that tells Excel to perform a SUM operation while ignoring rows hidden by a filter.
The primary advantage of using Subtotal 9 over a standard SUM function is dynamic reporting. A standard SUM formula adds every cell in a range regardless of whether the row is visible or hidden. In contrast, Subtotal 9 ignores any rows that have been filtered out. This allows you to change your filter criteria and see the total update instantly to reflect only the data currently on your screen.
What You'll Need
- A computer with Microsoft Excel installed (Windows or macOS).
- A dataset organized in rows and columns with a header row.
- Numeric data in the column you wish to total.
- The Filter feature enabled on your data range.
Step-by-Step
- Prepare Your Data: Ensure your data is organized in a clean table format. Every column must have a unique header (e.g., "Date", "Category", "Amount"). Ensure there are no completely empty rows or columns within the data block, as this can break the range selection.
- Apply Filters: Click anywhere inside your data range. Navigate to the Data tab on the ribbon and click the Filter button. You will now see drop-down arrows in each header cell.
- Position Your Total Cell: Click in the cell where you want the total to appear. It is highly recommended to place this cell above your data headers rather than below. If you place it below, the total cell itself might be hidden when you filter the data, making it impossible to see your result.
- Enter the Formula: Type
=SUBTOTAL(9,into the cell. The number 9 specifically instructs Excel to use the SUM function. - Select the Range: While the cursor is still inside the parentheses, click and drag to select the entire column of numbers you want to sum. For example, if your amounts are in column C from row 5 to row 100, your formula will look like
=SUBTOTAL(9, C5:C100). - Complete the Entry: Press Enter. The cell will now display the sum of all values in that range.
- Test the Filter: Click the filter drop-down arrow in one of your header columns and uncheck a few categories. You will notice that the value in your Subtotal 9 cell changes automatically to reflect only the visible rows.
Common Mistakes
One of the most frequent errors is confusing the function index 9 with the function index 109. While both perform a sum, they behave differently regarding manually hidden rows. Index 9 ignores rows hidden by a Filter, but it includes rows that you have hidden manually (by right-clicking a row and selecting Hide). Index 109 ignores both filtered-out rows and manually hidden rows. If your total seems too high despite your filters, check if you have manually hidden rows that should be excluded.
Another common mistake is placing the SUBTOTAL formula at the bottom of a dataset. When you apply a filter to the data above it, Excel may treat the formula row as part of the data range. If the filter criteria exclude the row containing your formula, your total will disappear from view. Always place your summary formulas in the top rows (frozen panes) or on a separate summary sheet.
Users also frequently forget to include the entire range in the formula. If you add new rows to the bottom of your list but your formula only goes to C100, the new data in C101 and beyond will be ignored. To prevent this, you can convert your data range into an official Excel Table (Ctrl + T), which allows the SUBTOTAL function to use structured references that expand automatically.
Tips
To make your Subtotal 9 formula more robust, use a Table. When you convert your range to a Table, you can use the "Total Row" feature. Go to the Table Design tab and check the Total Row box. Excel will automatically add a row at the bottom with a drop-down menu allowing you to choose "Sum," which internally uses the SUBTOTAL function. This is the fastest way to implement this logic without typing formulas manually.
If you need to perform different calculations on the same filtered set, remember that the first argument of the SUBTOTAL function can be changed. For example, changing the 9 to a 1 will give you the average of the visible cells, while changing it to a 2 will give you the count of numeric cells. You can set up a small dashboard at the top of your sheet with Sum (9), Average (1), and Count (2) to get a full snapshot of your filtered data.
For those who prefer keyboard efficiency, you can use the Alt + = shortcut to create a standard SUM. If you then manually change the word "SUM" to "SUBTOTAL" and add the "9," you can quickly transition a static total into a dynamic one. Additionally, using Ctrl + Shift + L is the fastest way to toggle filters on and off, which allows you to quickly test if your Subtotal 9 formula is responding correctly to different data views.
Troubleshooting
The total is not changing when I filter: First, verify that you used the SUBTOTAL function and not the SUM function. SUM always totals everything. Second, check that the range in your formula matches the actual range of your data. If your data extends to row 500 but your formula is =SUBTOTAL(9, C2:C100), the values from 101 to 500 will not be affected by the filter in a way that impacts the result correctly.
The formula returns a #VALUE! error: This usually happens if there are non-numeric values (like text or error messages) within the range you selected. While SUBTOTAL generally ignores text, certain types of errors (like #N/A or #DIV/0!) within the source data will cause the SUBTOTAL formula to fail. Use the Find and Replace tool to clear errors or wrap your source data in IFERROR functions to ensure only numbers are processed.
The total is 0 even though data is visible: Check the formatting of your numbers. If your numbers are formatted as "Text," Excel cannot sum them. You can tell if numbers are stored as text if they are aligned to the left of the cell by default or if there is a small green triangle in the top-left corner of the cell. Select the range, click the warning icon, and select Convert to Number.
Frequently Asked Questions
What is the difference between SUBTOTAL(9,...) and SUM()?
SUM adds every cell in the specified range regardless of visibility. SUBTOTAL(9,...) only adds cells that are visible after a filter has been applied, making it essential for dynamic reports.
Can I use Subtotal 9 in an Excel Table?
Yes. In fact, using a Table is recommended. You can enable the Total Row in the Table Design tab, which uses the SUBTOTAL function automatically to ensure totals update as you filter the table.
Does Subtotal 9 work with hidden rows?
It ignores rows hidden by the Filter tool. However, if you hide a row manually (Right-click > Hide), Subtotal 9 will still include that row in the calculation. Use 109 instead of 9 to ignore manually hidden rows.
Is there a keyboard shortcut to type the formula faster?
There is no dedicated shortcut for the SUBTOTAL function. However, you can use Alt + = to create a SUM and then manually edit it, or create a custom Macro to insert the formula with a single keystroke.
Why does my Subtotal 9 result change when I sort the data?
Sorting should not change the result of a Subtotal 9 formula as long as the range is correctly defined. If the result changes, you may have a relative cell reference that is shifting or a range that does not cover the entire dataset.