AI basics & verificationPractical AI workflows

Is an AI-written Excel formula correct? Test four rows for missed records

Check an AI-written Excel formula against an independently calculated sample, then change one record to test its response. Returning 80 once can conceal a missing row. This single-condition exercise includes paste-ready data, a complete request, faulty formulas and expected results for each test.

a calculator and a pen sitting on top of a piece of paper
Illustrative photo: Aaron Lefler · Unsplash License

What changed: Added paste-ready data, a complete request, two faulty formulas and isolated mutation tests to expose formulas that only appear correct.

Key Takeaways

Sum numeric amounts only for Paid records: 50+30=80 in the original four rows. Inspect B2:B5 and C2:C5, then test status changes, an excluded amount and an appended record separately. Restore the original sample before each test and record calculations in your actual spreadsheet application.

In this article

Define the input and calculation rule

Create a test sheet with headers in row 1: A is ID, B is status and C is amount. This example sums only exact Paid records, excluding Unpaid and Refunded, through row 5. Amounts are numeric. It is an original editorial exercise without real customer or financial records.

Give Claude or another assistant the structure, sample range, condition, software and locale. 'Find the total' leaves important decisions unspecified. Clarify missing amounts, refunds and dates before asking for a formula, and check authorization before submitting a business workbook.

Paste into A1 and establish the independent answer: 80

Paste the tab-separated block into A1 of a new sheet to fill A1:C5. If it stays in one column, split on tabs. Ensure C contains numbers. Only rows 2 and 4 qualify: 50+30=80. The Unpaid amount of 20 and Refunded amount of −10 are excluded.

This is an editorial exercise with arithmetic reference values, not a claim that a particular AI account or every spreadsheet application was tested. If your reporting policy subtracts refunds, revise the policy and expected answers before choosing a formula.

Four-row conditional-sum exercise

ID	Status	Amount
O-01	Paid	50
O-02	Unpaid	20
O-03	Paid	30
O-04	Refunded	-10
The first row is a header. Work in a copy, away from the production workbook.

Give AI the rule instead of asking it to invent one

Specify the application, range, status rule and numeric type, then request an explanation of references. Anthropic recommends allowing uncertainty. Asking questions when requirements are missing applies that advice; it does not guarantee a correct formula.

A complete reusable request

I use Excel. The exercise is in A1:C5: A=ID, B=Status, C=Amount. Row 1 is a header and C2:C5 are numbers.
ID Status Amount
O-01 Paid 50
O-02 Unpaid 20
O-03 Paid 30
O-04 Refunded -10
Sum Amount only where the Status cell value is Paid. Exclude Unpaid and Refunded. Do not match a substring containing Paid or invent a refund deduction.
Give a formula with fixed rows 2 through 5, explain criteria and sum ranges, and state what happens when row 6 is added. Ask about missing requirements; do not modify a workbook.
An editorial request, not a measured response from a model.

Two faulty formulas: one fails now, one passes by coincidence

The candidate is =SUMIF($B$2:$B$5,"Paid",$C$2:$C$5). Microsoft explains the criteria and sum ranges. This checks a whole status value rather than a substring; it does not claim case-sensitive status validation.

=SUMIF($B$2:$B$5,"*Paid*",$C$2:$C$5) also matches Unpaid and gives 100. Meanwhile =SUMIF($B$2:$B$4,"Paid",$C$2:$C$4) omits row 5 but still gives 80. Change row 5 to Paid: the complete range should return 70, while the shortened range remains at 80. One correct total would miss that defect.

How a missing row passes one check

Original sample: both ranges give 80

B2:B5 / C2:C5 → 80 B2:B4 / C2:C4 → 80

Change only row 5 status to Paid

Complete range: 50 + 30 - 10 = 70 Row 5 omitted: 50 + 30 = 80

A qualifying negative amount retains its sign. Refund handling depends on the stated status and reporting policy, rather than treating every negative number alike.

Restore the sample before changing one thing

Run each test independently from the original four rows. Inspect the formula, then calculate it in the target application. Regional settings may require different argument separators. Resolve syntax first; an error display is not a numeric answer.

Independent test cases: reference values are derived; fill in actual results after running
Only changeRangeExpectedWhat it exposes
NothingRows 2–580Basic criterion and amount field
Unpaid amount 20→200Rows 2–580Incorrect inclusion of unpaid records
Row 4 Paid→UnpaidRows 2–550Ignored criterion or misaligned reference
Row 5 Refunded→PaidRows 2–570Omitted last source row
Append row 6: Paid, 40Still rows 2–580A fixed range does not include the new row
Append that row and extend both rangesRows 2–6120Criteria and sum ranges extended together

These cases are not exhaustive proof. Missing amounts, text numbers, additional conditions or new statuses need separate expectations and failure handling. Returning zero with IFERROR does not establish that a defect was repaired.

Inspect rules, types and ranges before hiding errors

Identify the intended rows first, then examine status spaces or spelling differences, amounts stored as text, included headers and missed final rows. Do not immediately suppress errors: doing so can make an incorrect result appear usable while removing the clue.

A no-match case should return zero. How to handle a matching record with a missing amount needs an explicit business rule. For multiple conditions, revisit the function and cases rather than copying a single-condition expression unchanged. The AI-built tool acceptance guide offers related ways to separate ordinary, boundary and invalid inputs.

Preserve the formula and its acceptance evidence

Record the formula version, software, range, rule, expected values and actual values. Repeat relevant checks when columns, rows or rules change. An earlier correct total cannot establish correctness under new conditions. AI explanations can aid reading but do not replace independent verification.

If AI first extracts numbers from a document, use the AI material-summary checking workflow to verify the inputs. A correct formula cannot repair a mistyped or unsupported number. This is not a financial-report validation and does not claim identical results from every model or spreadsheet application.

Common questions

Does no Excel error mean the formula is correct?

No. Wrong columns, missing rows and unintended rules can still produce numbers. Check the included records against independent expected totals.

Can I ask AI to check itself again?

Use that as additional assistance, not as a replacement for independent expectations and execution in the target software. Repeated errors can still be stated confidently.

Why was a new row excluded?

This example uses a fixed range through row 5. Extend it or choose suitable data organization when requirements change, then check the result again.

Further reading & sources

Newer articles on this topic

Continue with a newer article that refers to this guide or explainer.