Back to all posts
Article

How to Use AI to Write Excel Formulas You Can Check

Author:

Use a six-row orders table to ask AI for a SUMIFS formula, verify the expected total, and test changes before applying the formula to your own Excel data.

A compact grid card with a magnifying lens inset over one cell

You need the value of paid online orders. An AI assistant can suggest an Excel formula, but “total the sales” leaves two decisions unstated: which orders count, and what the amount column represents.

Start with a small table where you can calculate the answer independently. Ask for the formula, its explanation and the included rows. Then change an input to see whether the result responds correctly. This gives you a way to check the formula before putting it near a larger workbook.

Make the inclusion rule explicit

This fictional dataset has one row per order. Amount is the whole order value in USD, not a unit price. Count a row only when Channel is Online and Status is Paid. A zero is a recorded amount; a missing amount would need investigation.

Paste the tab-separated block into cell A1 of a blank worksheet. Check that the headers occupy A1:D1 and the six orders occupy rows 2–7. If everything lands in column A, split the pasted text using the tab delimiter before continuing.

Order	Channel	Status	Amount
O101	Online	Paid	120
O102	Store	Paid	80
O103	Online	Pending	60
O104	Online	Paid	90
O105	Online	Refunded	40
O106	Online	Paid	0

Keep these sample labels unchanged for the exercise, even if your Excel interface uses another language. The text criteria in the formula refer to the cell contents, not the interface language.

Without AI, mark the rows that count: O101, O104 and O106. Their sum is 120 + 90 + 0 = 210. The paid store order does not count, and neither do the pending and refunded online orders.

Ask for a formula, not just a total

You can use a text assistant for this step; it does not need access to your actual business workbook. Supply the small fictional table and its cell locations:

I am using Excel. Headers are in A1:D1; data is in A2:D7.
A is Order, B is Channel, C is Status, D is Amount in USD.
Each row is one order, and D contains the whole order amount.

Write a formula for F2 that sums Amount only when Channel is Online
and Status is Paid. Include both conditions. Use ordinary Excel
functions and English function names. Explain each range and list
the order IDs that should be included. Do not change the source data.

[Paste the sample table.]

A reference formula for this task is:

=SUMIFS(D2:D7,B2:B7,"Online",C2:C7,"Paid")

This is an authored reference answer, not a claim that every assistant produces the same response. Microsoft's SUMIFS documentation defines how to add values meeting multiple criteria.

Read it in order: sum D2:D7, but only for rows where B2:B7 matches Online and C2:C7 matches Paid. All three ranges cover the same six rows. A formula using only the channel condition would include orders that have not been paid.

Put a descriptive label in F1, such as Paid online orders (USD), and the formula in F2. The label should preserve the rule, so someone reading the result knows what 210 means.

Check the result and the selected rows

If F2 shows 210, compare the included IDs as well. The right total can occur by coincidence in another dataset. Here, the intended contributing rows are 2, 5 and 7.

A wrong result is useful evidence. A result of 310, for example, matches all online amounts in this sample: 120 + 60 + 90 + 40 + 0. That suggests checking whether the payment-status condition was omitted; it is a diagnostic clue, not proof of the cause in every workbook.

If Excel rejects the formula, check how your installation expects function names and argument separators. The example uses English function names and commas. An installation using semicolons may need ; between arguments. Do not replace the ordinary double quotes around Online and Paid with typographic quotation marks. These are syntax adjustments; they do not change which orders should count.

Microsoft's formula error guidance provides checks for errors and unexpected results. Adding IFERROR(...,0) immediately would hide a symptom before you understand it.

Test changes you can predict

Run these one at a time, restoring the original data after each test:

ChangeExpected F2What it checks
Change C4 from Pending to Paid270O103 now qualifies, adding 60
Change D3 from 80 to 800210A store order remains excluded
Change D7 from 0 to 5215The last data row is included
Restore the original table210The test edits have been removed

These cases check more than whether the original formula happens to display a number. They test an order entering the selected group, a large change outside it, and the last row of the range.

The formula and these changes were checked in an independent spreadsheet calculation engine for this article. They were not a test of an AI app's workbook-editing feature. Run the checks in your own Excel installation before adapting the formula.

Extend the data only after the small case works

This reference deliberately ends at row 7. If you add a new order on row 8, the existing formula will not include it. Extend all three ranges together, or use an Excel Table with references that follow its rows. Check a newly added qualifying order rather than assuming the range expanded.

For your own data, replace the sample labels with the actual values in the cells. Decide how to handle incomplete amounts or inconsistent statuses before treating the result as a report. Formatting text as currency does not by itself establish that every source value is numeric.

When asking AI for a correction, describe the failed check: “Changing C4 to Paid should add 60, but F2 did not change. Check the ranges and both criteria.” Keep the original table available. Accept the formula when the rule, selected rows and predicted changes agree—not just when the explanation sounds plausible.

References