Excel’s Subtotal function is supposed to let you calculate subtotals only for rows marked with a specific key (like selection, visibility, or blank values), but it often fails if the data isn’t formatted right or the settings aren’t applied correctly. The issue usually stems from misconfigured subtotal criteria, incorrect column references, or hidden formulas overriding the function. Here’s what to do immediately to fix it.

What You’ll Need

  • A working Excel spreadsheet (2016 or later; older versions may not support all subtotal features)
  • The data range where subtotals should appear (e.g., A2:D100)
  • Basic knowledge of Excel’s formula syntax (e.g., `SUMIF`, `COUNTIF`)
  • If using subtotals with nested tables, the table must be formatted as a table (Ctrl+T)

Step-by-Step

  1. Check the subtotal criteria settings. Press Alt + F11 to open the VBA editor, then navigate to ThisWorkbook > Add-In. If subtotals appear disabled, add this line (replace # with your key value, e.g., 2 for "selected rows"): SubSubTotalKey = # Exit the VBA editor and restart Excel. Alternatively, on the Data tab, go to Data Tools > Subtotal. Check the Values dropdown to ensure it matches your data columns (e.g., "Count of A", "Sum of B"). If the dropdown is empty, restart Excel or run this VBA snippet to force a refresh: Sub RefreshSubTotals() ActiveWorkbook.Subtotals.Refresh End Sub
  2. Verify the subtotal range. If subtotals aren’t showing under your data, drag the subtotal row down to include more rows. For example, if your data is A2:D100, drag the subtotal row to D101 or higher. Press Ctrl + Shift + End to jump to the last cell and drag the subtotal row downward.
  3. Clear hidden formulas. Some users report that hidden formulas (e.g., calculated fields in nested tables) conflict with subtotals. Select the subtotal row and press Ctrl + ; to show all hidden formulas. Delete or comment out any conflicting formulas (e.g., `=SUMIF(A:A, "<>", B:B)` if it’s overriding `SUMIF`).
  4. Use a table if applicable. If your data is structured as a table (Ctrl+T), subtotals appear automatically under the Table Tools > Design tab. Go to Insert Subtotals and select your grouping columns. This method avoids manual formula errors.
  5. Reapply subtotals. If subtotals appear but calculations are wrong, right-click the subtotal row and choose Clear > Contents. Then reapply subtotals with the correct criteria.

If That Did Not Work

If the above steps fail, the issue may stem from a corrupted worksheet or Excel’s calculation engine. Try these advanced fixes:
  1. Enable iterative calculations. Go to File > Options > Formulas. Check Iteration and set Max iterations to 100. Restart Excel—this forces Excel to recalculate subtotals without skipping rows.
  2. Check for Excel’s hidden errors. Press Alt + F11, then go to ThisWorkbook > Code. Add this line to log errors: Private Sub Workbook_Open() Debug.Print "Error: " & Application.Caller End Sub Check the Immediate Window (Ctrl + G) for errors during subtotal application.
  3. Repair Excel’s calculation settings. Go to File > Options > Advanced. Under Calculation Options, ensure Enable iterative calculation is checked. Restart Excel.
  4. Reset the worksheet. Close all open workbooks, then open a blank Excel file. Copy your data range and paste it into the new sheet. Apply subtotals again—this bypasses corrupted settings.

Common Mistakes

  • Skipping blank rows. Subtotals ignore blank cells by default. If you need to include them, use a custom key (e.g., `#` in VBA) or convert blanks to zeros with `=IF(A2="",0,A2)` before applying subtotals.
  • Using column headers twice. If your data includes headers in the first row, subtotals may miscalculate. Move headers to the top of the table or add a blank row above the data before applying subtotals.
  • Ignoring table formatting. In Excel 2019+, subtotals must be applied within a table. If you manually add subtotals to a non-table range, they may break when the table is recreated.
  • Disabling subtotals in the ribbon. Some users accidentally uncheck subtotals in the Data tab’s toolbar. Double-click the subtotal row to re-enable it.

Tips

  • Use conditional formatting to highlight subtotal rows. Select the subtotal row and go to Home > Conditional Formatting > New Rule. Choose Format cells containing > Blank and apply a background color.
  • Export to CSV if subtotals still fail. Right-click the subtotal row > Copy, then paste into a new worksheet. Export the file and reapply subtotals in a clean sheet.
  • Test with a fresh dataset. Create a test sheet with known values (e.g., 10 rows of data with subtotals). If subtotals work here, the issue is in your original data or settings.
  • Enable "Show All Tables" in VBA. If you’re using tables, ensure no subtotal settings are hidden. Go to Tools > Options > Edit and check Show All Tables.

Troubleshooting

If subtotals persist, follow this order: 1. Restart Excel: Sometimes a simple restart resolves calculation glitches. 2. Check for add-ins: Go to File > Options > Add-ins. Disable non-Microsoft add-ins and restart. 3. Update Excel: Ensure you’re using the latest version (File > Help > Check for Updates). 4. Recreate the worksheet: Copy your data to a new worksheet and apply subtotals fresh. 5. Check for Excel errors: Press Ctrl + Shift + G to run the Error Watcher. If errors appear during subtotal application, note the message and debug step-by-step. 6. Repair Excel via Control Panel: Close Excel, then run DISM.exe /Online /Cleanup-Image /RestoreHealth and sfc /scannow in Command Prompt (Admin) to repair system files.

Frequently Asked Questions

Why do subtotals sometimes show as blank?

Subtotals appear blank if they’re calculated based on empty input ranges (e.g., no data in the grouped column) or if the subtotal row was manually deleted. To fix, drag the subtotal row down to ensure it spans all data or convert empty cells to a valid key (e.g., `#` in VBA).

Can I use subtotals in a filtered view?

No. Subtotals only work in filtered views if you apply them after filtering (Excel recalculates totals dynamically). Alternatively, use a table with Insert Subtotals or export to a new sheet before filtering.

Will subtotals work in a Power Query table?

No. Subtotals do not natively support Power Query tables. Convert the query to a table (right-click > Convert to Table) or use a separate worksheet for calculations.

How do I exclude certain rows from subtotals?

Use a custom key in VBA. For example, to exclude rows where column A = "Exclude," add this to your VBA settings: SubSubTotalKey = 100 Then, in your data, use `=IF(A2="Exclude",0,A2)` to treat "Exclude" rows as zeros.

Why do subtotals change when I edit other cells?

This happens when Excel recalculates totals in real-time due to iterative mode or conflicting formulas. Disable iterative calculation (File > Options > Formulas) or wrap subtotal logic in a `NONALEXCEL` function (if using Excel 2019+).

Can subtotals work with merged cells?

No. Merged cells disrupt subtotal calculations because their ranges become irregular. Unmerge cells or adjust subtotal ranges to avoid overlaps.

If none of these solutions work, the issue may be a deeper Excel corruption. Create a new Excel file and manually duplicate your data structure to isolate the problem.