Skip to content

Coach Winona · AI at Work · Intermediate

Can AI total this spreadsheet without counting subtotals twice?

A report says the team spent $815. The actual total is less than half that. Open the same file in Excel or Google Sheets and find what the report counted twice.

Download the eight-row practice CSV. Open it in Excel or import it into a blank Google Sheet. You can finish this exercise without an AI account.

Eight rows, one reportPractice example
ID
Row type
Amount
N-101
detail
$120
N-102
detail
$85
N-102
detail (repeat)
$85
S-201
detail
$90
S-202
detail
$35
S-203
detail
$35
N-SUB
subtotal
$205
S-SUB
subtotal
$160
All eight
raw sum
$815
Sample rows from the page’s practice CSV (A2:D9). Highlighted rows are the ones the worked check excludes.

Check that all eight amounts came in as numbers

Below the data, so a filter will not hide them, enter =COUNT(D2:D9) in G11 and =SUM(D2:D9) in G12. Expect 8 numeric cells and a raw sum of $815. You are checking the import, not approving $815 as the answer. If either result differs, stop and check that the data landed in A1:D9 with the amounts in column D. Reimport with the correct separator and number format if necessary; don't change a source amount to make a formula agree.

To see why the check matters, work in a copy. Replace the first amount with '120 (an apostrophe followed by 120). It looks the same in the cell, but the numeric count should fall to 7. Enter 120 again without the apostrophe in a number-formatted cell and confirm both checks before you continue.

First, check the importComparison
Check
Expect
=COUNT(D2:D9) in G11
8 numeric cells. In a copy, replace the first amount with '120: the count should fall to 7.
=SUM(D2:D9) in G12
A raw sum of $815.
You are checking the import, not approving $815 as the answer.

Decide which rows belong in the total

  1. Include both regions and count only rows labeled detail. The subtotal rows are there for reference, not new expenses.
  2. Keep only the first exact repeat of each record ID in this file. If two rows share an ID but disagree on the amount, stop and check the source rather than choosing one. Two different IDs with the same amount can both be valid.
  3. Calculate the result in the sheet. Then explain what was excluded and how you know.
Which rows belong in the totalDecision diagram
Decision diagram for the Include column: is the row labeled detail? If not, exclude it, because subtotal rows are for reference. If yes, has this record ID appeared before? If it has, exclude it as a repeat. If not, include it. If two rows share an ID but disagree on the amount, stop and check the source.Row labeled detail?No: exclude.Subtotal is reference.Yes: first timethis ID appears?Yes:includeNo:excludeSame ID, different amount?Stop and check the source.
Rules from Decide which rows belong in the total and the Include? formula. Two different IDs with the same amount can both be valid.

Make a check you can reuse

Leave columns A through D intact. Start with the original row order. In E1 enter Include?. In E2 enter the formula below and fill it down through E9. It checks for detail rows and counts how many times the current ID has appeared in the ID column so far.

=IF(B2="detail",COUNTIF($A$2:A2,A2)=1,FALSE)

In G13 enter =SUMIF(E2:E9,TRUE,D2:D9). This adds the amounts on the included rows in both regions. To check one region separately, filter E to TRUE and C to South within A1:E9, then enter =SUBTOTAL(109,D2:D9) in G14. G13 is still the all-regions total; G14 is the visible-rows total. If your spreadsheet uses semicolons between function arguments, use those in place of the commas.

From $815 to $365Practice example
Step
Amount
Raw sum, all eight rows
$815
Less North subtotal row
−$205
Less South subtotal row
−$160
Less the extra $85 record
−$85
Five detail records
$365
North is $120 + $85 = $205. South is $90 + $35 + $35 = $160. Keep both S-202 and S-203.
Show the worked check

All regions: $365 across five detail records. North is $120 + $85 = $205. South is $90 + $35 + $35 = $160. Keep both S-202 and S-203. The unfiltered raw total of $815 contains the extra $85 record and both subtotal rows ($205 + $160). Filter to South and included rows and the visible-rows formula returns $160.

Try to break the check: In a fresh copy, change S-203 to $40. The correct all-regions total becomes $370 and South becomes $165, but the printed South subtotal still says $160. A workflow that trusts printed subtotals misses the change. If you sort the source, recompute the Include formulas top to bottom and recheck the five accepted IDs.

Try to break the checkPractice example

Trusts printed subtotals

The printed South subtotal still says $160.

The correct totals

Change S-203 to $40: all regions $370, South $165.

A workflow that trusts printed subtotals misses the change.

Try these prompts

Use an approved assistant with model training OFF. Replace the brackets with non-confidential details. Leave out private records even when training is off.

Audit the rows before totaling

Review [non-confidential table excerpt] using [record ID column] and [row type column]. List the included record IDs and every excluded row with its reason. Flag conflicting amounts for the same ID and stop before calculating if any conflict remains. Do not drop different IDs that happen to have the same amount.

Explain why two totals differ

Compare [all-rows formula and result] with [visible-rows formula and result] in [spreadsheet app]. Given [active filters and non-confidential column labels], explain which rows each formula sees. Propose one change to a detail amount that would reveal whether a printed subtotal is being trusted.

Spreadsheet references

Back to the spreadsheet workflow lessons

The AI PulseWhat actually matters in AI, minus the hype — twice a week.
Free forever · unsubscribe anytime · all 14 newsletters
That email did not go through — please check it and try again.