New Tool Radar

AI for Data & Spreadsheets

How to Check Whether an AI-Written SUBTOTAL Ignores Filtered-Out Rows

Check whether an AI-written SUBTOTAL ignores filtered-out rows where a SUM would include them.

Schematic with three steps: Read the function and its code; Add the visible rows by hand; Use code 109 and re-check.

SUM adds every value in its range, including rows hidden by a filter, while SUBTOTAL with function code 109 adds only the visible rows. An AI-written total that uses SUM on a filtered list therefore counts rows the reader cannot see, and the total disagrees with the rows on screen. Check the function code before trusting a total on a filtered list.

What you need

  • The AI-written total formula and the filter applied to the list
  • The rows visible on screen and their total
  • A hand-added total of the visible rows

Step 1: Read the function and its code

Click the total cell and read the formula. SUBTOTAL(109,…) ignores filtered-out rows, while SUBTOTAL(9,…) and SUM include them.

Step 2: Add the visible rows by hand

Add the values in the rows visible on screen and write the hand total down. If the formula’s result is larger, it is counting hidden rows.

Step 3: Use code 109 and re-check

Change the formula to SUBTOTAL(109, range) and compare with the hand total. Then change the filter and confirm the total moves with the visible rows.

Worked example: synthetic filtered East sales

The table below is a synthetic example. It shows the expected result of checking an AI-written total on a filtered list; no formula was run.

Check Value Result
Rows visible after filter 6 East rows Hand total 310
SUM result 520 Counts hidden rows too
SUBTOTAL(9) result 520 Same as SUM
SUBTOTAL(109) result 310 Matches the visible rows

Expected result (UNTESTED). SUM and SUBTOTAL(9) both return 520 on the filtered list, because they count hidden rows; SUBTOTAL(109) returns 310, matching the hand total of the six visible East rows. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • SUBTOTAL ignores other SUBTOTALs in its range, so nested subtotals do not double-count.
  • Function codes 101 to 111 also ignore manually hidden rows, while codes 1 to 11 ignore only filtered-out rows.
  • SUBTOTAL does not ignore rows hidden by grouping; it only ignores filtered rows.
  • A total that must count hidden rows too should use SUM, not SUBTOTAL(109).

Sources

See all