The SUBTOTAL function in Excel may not work due to incorrect syntax, hidden rows, mixed data types, or accidental manual overrides. The function calculates visible cells only in filtered lists and ignores other SUBTOTAL results within the range, making it ideal for dynamic summaries. To fix it, check your range, ensure you're using the correct function number, and verify no cells are formatted as text.

What You'll Need

  • An Excel workbook with a column of numerical data
  • A filtered or grouped dataset (optional but recommended for SUBTOTAL’s purpose)
  • Access to Excel 2010 or later (function works in all modern versions)

Step-by-Step

  1. Identify the column where you want to calculate a subtotal. For example, if you’re summing sales in column D, make sure every cell in that column contains a number—no text, blanks, or errors.
  2. Select the cell directly below your last data row (or where you want the total to appear).
  3. Type =SUBTOTAL( and immediately press Ctrl + A to open the Function Arguments dialog box. This prevents typos in the function number.
  4. In the Function_num dropdown, choose the correct code: use 9 for SUM, 1 for AVERAGE, 2 for COUNT, 109 for SUM ignoring manually hidden rows. For most cases, use 9 or 109.
  5. Click inside the Ref1 field, then drag your mouse to select the exact range of cells you want to subtotal—do not include the SUBTOTAL cell itself or any other SUBTOTAL results.
  6. Press Enter. The formula should now appear as =SUBTOTAL(9,D2:D100) (adjust range as needed).
  7. Apply a filter to your data (Data > Filter). Click the dropdown arrow in your column header and hide a few rows by unchecking values. The subtotal should automatically update to show only visible cells.
  8. Manually hide a row by right-clicking the row number and choosing Hide. If you used 9, the subtotal will still include it. If you used 109, it will ignore it. This confirms you’re using the right function number.
  9. If the result is still wrong, select the cell and check the Formula Bar. If you see text like '=SUBTOTAL(9,D2:D100) (with an apostrophe), delete the apostrophe—it means the cell is formatted as text.

Common Mistakes

  • Using function number 9 instead of 109 when you need to ignore manually hidden rows. Function 9 includes manually hidden rows; 109 ignores them.
  • Including other SUBTOTAL formulas in the range—this causes circular references and returns 0 or #VALUE!.
  • Formatting numeric cells as Text. Even if a cell displays a number, if it’s formatted as Text, SUBTOTAL ignores it entirely.
  • Typing the formula manually without checking the function number (e.g., typing SUBTOTAL(5) instead of 9, which gives you COUNTA instead of SUM).
  • Creating a range that includes headers, footers, or summary rows outside the intended data. Always double-check the selected range.

Tips

  • Use 109 for SUM, 101 for AVERAGE, and 102 for COUNT to always ignore manually hidden rows. This is essential if users might hide rows outside of AutoFilter.
  • Use the Insert Function button (fx) next to the Formula Bar to pick SUBTOTAL—it auto-fills the correct number and prompts for the range, reducing errors.
  • After applying a filter, press Ctrl + Shift + L to toggle filters on/off quickly and verify the subtotal updates correctly.
  • Use conditional formatting to highlight cells that are not numbers. Select your range, go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format, then enter =ISTEXT(A1) and set a red fill. This reveals text-formatted numbers.
  • Always test your SUBTOTAL by hiding a few rows manually and checking if the result changes. If it doesn’t, you’re likely using 9 instead of 109.

Troubleshooting

  1. If the formula returns #VALUE!, check that the range includes only numbers. Remove any text, #N/A, or #DIV/0! errors in the range. Use =ISNUMBER(D2) to test individual cells.
  2. If the result is 0 or unchanged after filtering, verify the function number is 9 or 109. Function numbers 1–11 include hidden rows in different ways—only 101–111 ignore manual hiding.
  3. If the cell displays the formula as text (e.g., you see =SUBTOTAL(9,D2:D100) instead of the result), select the cell, press F2, then Enter. If it still shows text, change the cell format to General or Number via Home > Number > Number.
  4. If you copied the formula from another cell and it broke, check if the cell references changed. Use absolute references (e.g., $D$2:$D$100) if copying across multiple columns.
  5. If the subtotal doesn’t update when you add new data, extend your range. Consider converting your range into an Excel Table (Ctrl + T). SUBTOTAL works automatically with tables, and new rows are included without adjusting the formula.
  6. Restart Excel and reopen the file. Rarely, calculation mode may be set to Manual. Go to Formulas > Calculation Options and ensure it’s set to Automatic.
  7. If none of these work, recreate the formula from scratch in a blank cell using the Insert Function method to eliminate typos.

Frequently Asked Questions

Why is my SUBTOTAL showing 0 even though there are numbers?

The cells may be formatted as Text. Select the range, press Ctrl + 1, choose Number, and click OK. Then press F2 and Enter on each cell, or use Find & Replace to replace = with =.

Can SUBTOTAL work with filtered data in a pivot table?

No. SUBTOTAL only works with standard Excel ranges and AutoFilters. Pivot tables use their own summary functions and ignore SUBTOTAL formulas placed beside them.

What’s the difference between SUBTOTAL(9) and SUBTOTAL(109)?

SUBTOTAL(9) includes rows hidden by manual hiding (right-click > Hide). SUBTOTAL(109) ignores them. Use 109 if users manually hide rows outside of filtering.

Can I nest SUBTOTAL inside another function?

No. Nesting SUBTOTAL inside SUM, AVERAGE, or other functions breaks it. Use it alone as the main formula. You can combine it with IF or INDEX if needed, but avoid embedding it within arithmetic operations.

Why does my SUBTOTAL return #NAME?

You likely misspelled the function name. Check for typos like SUBTOTALS or Subtotal. Excel is case-insensitive but requires exact spelling.

Does SUBTOTAL work with non-English Excel versions?

Yes, but the function name may be localized (e.g., SOMME.SI in French). Use the English name in formulas unless you’re in a non-English locale—Excel will translate it automatically if you use the Insert Function dialog.