SUBTOTAL with function number 3 gives you a sum that ignores rows you have hidden, so you can filter a list or manually hide rows and still see a total for only what is visible. The formula looks like this: =SUBTOTAL(3,A2:A100). Note that 3 counts non-empty visible cells (COUNTA behaviour), not values. If you want a visible-only sum of numbers, use 9 instead: =SUBTOTAL(9,B2:B100). Function number 3 is the count version, which is why it is often used to check how many rows survived a filter, while 9 is the one most people want for adding up amounts.

What You'll Need

  • Excel on Windows, Mac, Excel for the web, or a supported mobile version (the steps below use the desktop version; mobile layout differs slightly).
  • A list with a header row and at least one column of data, ideally formatted as a table or set up with AutoFilter on the header row.
  • A clear plan for which column you want to count (for 3) or add up (for 9).

Step-by-Step

  1. Set up your data cleanly. Put headers in row 1 and keep the data contiguous: no blank rows or columns in the middle of the range. Select the range and, on the Data tab, click Filter so each header gets a dropdown arrow. Labels can differ slightly by version, device and region, but Filter and SUBTOTAL have been stable for many versions.
  2. Decide what you are counting or summing. Use 3 to count visible non-empty cells (for example, how many orders remain after filtering). Use 9 to add visible numbers in a numeric column. If your numbers may themselves contain SUBTOTAL formulas, 109 excludes nested SUBTOTALs as well as hidden rows.
  3. Pick an empty cell below or beside the data. Leave one blank row between the last data row and your total so the total is not swept into the filtered range. A total placed inside the range can be counted or summed by itself.
  4. Type the formula. Click the cell, type an equals sign, then SUBTOTAL(. Excel shows a tooltip listing function numbers. Type 3, then a comma, then select your range, or type it directly. Press Enter. Example for counting visible order IDs: =SUBTOTAL(3,A2:A100).
  5. Check the reference is absolute if you will copy it. Press F4 after selecting the range to make it $A$2:$A$100 so copying to other columns keeps pointing at the same rows. On Mac, Fn+F4 or Cmd+T may be needed depending on keyboard settings; the toolbar can also toggle the reference type.
  6. Filter the list and watch the total change. Use a column dropdown to hide some rows. The 3 formula should drop to count only the visible non-empty cells; a 9 formula should drop to sum only visible numbers. Compare with a plain COUNTA or SUM in another cell to confirm the difference.
  7. Hide rows manually to test. Right-click row numbers and choose Hide. SUBTOTAL ignores manually hidden rows too, while the plain SUM or COUNTA does not. Unhide them with the row-number selection and right-click, or Data > Filter > Clear for filter states.
  8. Add a second subtotal by group if you want section totals. Sort by the grouping column, then use Data > Subtotal to insert automatic SUBTOTAL formulas at each change in group. Be aware this inserts outline rows; remove it with the same dialog's Remove All button when finished.

Common Mistakes

  • Using 3 when you meant to add numbers. 3 counts cells; it never adds values. A range of text entries will count fine, but you will not get a money total.
  • Using 109 inside a range that already has SUBTOTAL rows. The 100-series forms ignore other SUBTOTAL formulas, which is what you want for grand totals but can silently change results when you expected nested totals to add up.
  • Including the total row in the range. =SUBTOTAL(9,B2:B100) placed in B101 while the range already covers B101 creates a circular reference warning or a doubled total.
  • Expecting SUBTOTAL to see rows hidden by other means. Rows hidden by a filter or manual hide are ignored, but rows in a hidden worksheet or collapsed outline group behave differently in some versions; keep the summary on the same sheet to avoid confusion.
  • Mixing a filtered table with a plain SUM elsewhere. The plain SUM still includes hidden rows, so two totals on one sheet can disagree; label each one clearly.
  • Typing the function number in quotes. SUBTOTAL("3",...) returns a #VALUE! error. It must be a number.

Tips

  • Convert the range to a table (Insert > Table). Tables and their Total Row use SUBTOTAL automatically, and structured references like Table1[Amount] make formulas easier to read.
  • Remember the shortcut mapping: 3 = COUNTA, 4 = MAX, 5 = MIN, 9 = SUM, 1 = AVERAGE, 2 = COUNT. Prefixing with 10 (103, 109) excludes nested subtotals.
  • Put the formula in the header row area or a frozen pane cell so it stays visible while you scroll a long list.
  • If you need a visible-only average on filtered data with blanks, prefer AVERAGEIFS or 101 with care; blanks can skew a simple average.

Troubleshooting

If the total does not change when you filter, confirm the formula actually uses SUBTOTAL and not SUM. Select the cell and check the formula bar. If you see #NAME?, the function name is misspelled. If you see #VALUE!, the function number is likely in quotes or text. If you see a circular reference warning, the range includes the total cell; shrink the range. If filtering leaves the count stuck at the full number, the rows may not actually be hidden (check for a filter cleared by a refresh or a table that lost its filter). If the formula returns 0 when you expected a count, the cells may be truly empty or contain formulas returning ""; COUNTA-style counting treats empty strings as text in some cases depending on version, so check with a quick test. If the file is shared and totals look wrong for a colleague, refresh the data or verify they are not viewing a stale cached copy. If the sheet is protected, the cells you are trying to edit or filter may be locked; ask the sheet owner to unprotect or allow filtering.

If That Did Not Work

Try the simplest checks first: save and reopen the file, press Ctrl+Alt+F9 (or Cmd+= on Mac) to force a full recalculation, and verify the range addresses with the Name Box. If the workbook is in manual calculation mode, switch it to automatic via Formulas > Calculation Options. As a last resort, recreate the formula in a fresh cell and delete the old one; a corrupt formula reference is rare but easy to rule out.

Frequently Asked Questions

What does the 3 mean in SUBTOTAL?

3 tells Excel to behave like COUNTA: count visible, non-empty cells. Use 9 for a visible-only sum.

Does SUBTOTAL 3 ignore hidden rows?

Yes, it ignores rows hidden by a filter or by manual hiding. It does not ignore rows hidden by grouping in every version, so test with your file.

What is the difference between 3 and 103?

103 also ignores other SUBTOTAL formulas inside the range, which prevents double counting in nested totals. 3 counts them normally.

Why does my SUBTOTAL return the full count after filtering?

Usually the rows were not actually hidden, or the formula was replaced by SUM/COUNTA. Check the formula bar and reapply the filter.

Can I use SUBTOTAL on a whole column?

Yes, =SUBTOTAL(3,A:A) works, but it includes header text and can be slower. A bounded range is safer and easier to audit.

Does SUBTOTAL work in Excel for the web and on mobile?

Yes, SUBTOTAL is a standard function available across Excel platforms; the entry method differs, but the syntax is the same.