Subtotal Formula Shortcut Key: Quick Guide
In this article
The quickest way to add a SUBTOTAL formula in Excel is to select your data range, press Alt + = (Windows) or ⌘ + Shift + T (Mac) to insert an AutoSum, then change the function from SUM to SUBTOTAL in the formula bar. For a fully automated subtotal row that ignores other subtotals, use the Subtotal command under the Data tab, which has its own keyboard sequence: Alt + A, then B on Windows. This guide covers both methods, the exact shortcuts, and how to avoid double-counting.
What You'll Need
- Microsoft Excel (Windows or Mac) with a worksheet containing a column of numbers you want to subtotal.
- Your data organised in columns with a header row (no blank rows inside the range).
- Familiarity with the formula bar and the Name Box (optional but helpful).
Step-by-Step
- Select the range you want to subtotal. Click the first number and drag to the last, or click the column header if the entire column is numeric. Include only the cells to be summed, not the header.
- Insert an AutoSum. Press Alt + = on Windows. On Mac, press ⌘ + Shift + T. Excel inserts a SUM formula in the cell immediately below the selected range (or to the right if the range is horizontal).
- Change SUM to SUBTOTAL. With the formula cell still selected, click the formula bar, delete
SUMand typeSUBTOTAL. The formula becomes=SUBTOTAL(9, range). The number 9 tells Excel to use the SUM function while ignoring other SUBTOTAL formulas in the range. - Press Enter to confirm. The cell now shows the subtotal of the visible (non-subtotal) rows. If you later hide rows manually, the result updates to exclude them—this is the key difference from SUM.
- For automatic grouping and subtotals: select any cell inside your data, then press Alt + A to open the Data tab, followed by B to open the Subtotal dialog. (On Mac, use the Data menu > Subtotal.)
- Configure the Subtotal dialog. Choose the column to group by (e.g., Category), the function (Sum, Count, Average), and the column to subtotal. Tick Replace current subtotals and Summary below data, then click OK. Excel inserts SUBTOTAL formulas and outline groups automatically.
- Collapse or expand groups. Use the outline buttons (1, 2, 3) at the left of the sheet, or press Alt + A, then H to hide details and show only subtotals.
Menu labels and shortcut sequences can differ slightly by Excel version, device, and region. If a key combination does not respond, check that your keyboard layout matches the language version of Excel.
Common Mistakes
- Using SUM instead of SUBTOTAL. SUM adds every cell, including other subtotal rows, causing double-counting. Always use SUBTOTAL(9, range) for subtotal rows.
- Forgetting the function number. SUBTOTAL requires a number (1–11 or 101–111). Using 9 sums all rows; using 109 sums only visible rows. Mixing them up gives unexpected results when rows are hidden.
- Selecting the wrong range. AutoSum may guess the range incorrectly if there are blank rows. Always verify the range in the formula bar before pressing Enter.
- Including the header row. Text headers are ignored by SUBTOTAL, but including them can shift the range and cause errors if the header contains numbers.
- Using the Subtotal command on filtered data. The command works on the entire dataset, not just visible rows. Apply filters after subtotals are created, or use SUBTOTAL formulas manually.
Tips
- Use Alt + = then immediately type
SUBTOTAL(9,to replace the SUM quickly—Excel keeps the range selection. - For a grand total that ignores all subtotals, use
=SUBTOTAL(9, range)over the entire column, not SUM. - Press Ctrl + ` (grave accent) to toggle showing formulas, making it easy to check that SUBTOTAL is used everywhere.
- On Mac, the shortcut for AutoSum is ⌘ + Shift + T; the Data menu has a Subtotal option but no default keyboard shortcut—you can assign one via System Settings > Keyboard > Shortcuts.
- When using the Subtotal command, always tick Replace current subtotals to avoid stacking multiple subtotal rows.
Troubleshooting
- Alt + = does nothing. Ensure you are not in cell edit mode (press Esc first). Check that your keyboard has a dedicated equals key; on some laptops, use Fn + = .
- Subtotal returns 0 or an error. Verify the range contains numbers, not text. Check that the function number is correct (9 for sum, 109 for visible-only sum).
- Subtotal command is greyed out. Make sure your data has a header row and no blank rows. Select a single cell inside the data, not an entire column.
- Subtotals not updating after hiding rows. SUBTOTAL with function number 9 includes hidden rows; use 109 to exclude them. Change the number in the formula bar.
- Shortcut conflicts. Some add-ins or keyboard layouts override Alt + =. Try the ribbon: Formulas tab > AutoSum, then edit the formula.
Frequently Asked Questions
What is the shortcut key for SUBTOTAL in Excel?
There is no single dedicated shortcut for SUBTOTAL. Use Alt + = (Windows) or ⌘ + Shift + T (Mac) to insert AutoSum, then change SUM to SUBTOTAL. For the Data > Subtotal command, press Alt + A, then B on Windows.
Can I use SUBTOTAL with filtered data?
Yes. SUBTOTAL with function number 109 (or 101–111) ignores rows hidden by filters, so it sums only visible rows. Function number 9 includes filtered-out rows.
Why does my SUBTOTAL show a different result from SUM?
SUBTOTAL ignores other SUBTOTAL formulas within the range, preventing double-counting. SUM adds everything, including nested subtotals.
Is there a Mac shortcut for the Subtotal command?
Excel for Mac does not have a default keyboard shortcut for Data > Subtotal. You can create one via System Settings > Keyboard > Shortcuts > App Shortcuts.
How do I remove subtotals?
Select the data, open the Subtotal dialog (Alt + A, B), and click Remove All. This deletes the subtotal rows and outline groups.
Can I subtotal multiple columns at once?
Yes. In the Subtotal dialog, tick multiple columns under Add subtotal to. Excel creates a separate SUBTOTAL formula for each selected column.