Skip to content
Leverage AI

Free guide

Get an Excel formula you can check by hand.

To get an Excel formula from ChatGPT, give it your column letters, data types, Excel version and the calculation in plain English. Add a few made-up rows with a total you can check by hand, and ask for one formula plus which rows count. Then test it in a scratch sheet before you use it for work.

  • 4 steps
  • Free prompt
  • No upload needed

Published · Updated

Start building

What it does

You don't need to upload the workbook. For a monthly invoice total, the AI needs to know where the dates and amounts are, what "paid" means in your sheet, and where the month starts and ends.

We gave Claude Opus 5.5 seven made-up invoices and asked for one client's paid invoices dated in March. It returned a single SUMIFS formula. Three invoices count: 120 and 80, plus a credit of -20, for a total of 180, which matches the hand count. The 80 invoice is dated 16:30 on 31 March and stays in. A 900 invoice dated exactly 1 April stays out.

What you need

  • ChatGPT or Claude: you paste the prompt into a new chat.
  • Excel: the example uses Microsoft 365 with English function names and commas between arguments.
  • A blank scratch sheet: for testing the formula before it goes near your own workbook.

The steps

Step 1: Try the prompt as it is

Do the steps in order. Paste this into a new chat to try the made-up rows first.

text
Write one Excel formula for this task, then explain which rows
count and the expected total. Excel Microsoft 365, English
function names, comma argument separators. Headers in row 1,
data in rows 2:8. B = customer, C = invoice date/time (numeric
Excel dates), D = amount (numbers), E = status. Sum amounts for
customer "Client A", status "Paid", in March 2026. Include every
time on 31 March and exclude 1 April. Use bounded ranges and
DATE, not date strings. Do not use macros or change the sheet.

Fictional rows (A = row label):
row 2: INV-A | Client A | 2026-03-01 00:00 | 120 | Paid
row 3: INV-B | Client A | 2026-03-31 16:30 | 80 | Paid
row 4: INV-C | Client A | 2026-04-01 00:00 | 900 | Paid
row 5: INV-D | Client A | 2026-03-15 09:00 | 50 | Pending
row 6: INV-E | Client B | 2026-03-12 00:00 | 70 | Paid
row 7: INV-F | Client A | 2026-02-28 23:59 | 30 | Paid
row 8: INV-G | Client A | 2026-03-20 00:00 | -20 | Paid

Here is the March formula Claude returned for these rows:

excel
=SUMIFS($D$2:$D$8, $B$2:$B$8, "Client A", $E$2:$E$8, "Paid", $C$2:$C$8, ">="&DATE(2026,3,1), $C$2:$C$8, "<"&DATE(2026,4,1))

It counts rows 2, 3 and 8: 120 + 80 - 20 = 180. The other four rows are another client, a pending invoice, February, or 1 April. "Before 1 April" includes all of 31 March, so the 16:30 invoice counts.

Step 2: Check the March example

Use the March formula above and the seven fictional rows from step 1 for this test. Keep this scratch sheet separate from your own workbook.

  1. In a blank sheet, put the headers Invoice, Customer, Date, Amount and Status in A1:E1, then enter the seven rows in rows 2:8.
  2. Type dates as formulas: =DATE(2026,3,1) in C2, =DATE(2026,3,31)+16.5/24 in C3, and DATE formulas for the other rows. The February row only needs =DATE(2026,2,28). Enter -20 in D8 as a number.
  3. Paste the formula into G2. It should show 180.
  4. Change the 80 in D3 to 81: G2 should become 181. Put it back, then change the 900 in D4 to 901: the total should stay 180.

Tip: these checks catch a date limit that drops the last afternoon or picks up the next month.

Step 3: Describe your own sheet

Keep the first sentence of the prompt. Replace the rest with your version, columns and rule, then add a few made-up rows:

text
Excel [version], [language] function names, [comma or semicolon]
argument separators. Headers in row 1, data in rows [2:N].
[Column] = [what it holds and its type], [Column] = [...].
[What to add up or count, in plain English, including edge cases].
Use bounded ranges. Do not use macros or change the sheet.

Fictional rows:
row 2: [a row that should count]
row 3: [a row that should not count]

Tip: include rows that should be left out, like the 1 April invoice in the example. They catch a formula that counts too much.

Step 4: Test it and fit it to your real file

Test your own formula on made-up rows with a total you have worked out yourself; 180 is only the answer to our March example. Use the same kind of check as step 2: change a row that should count and watch the total move, then change one that shouldn't and make sure it stays put.

Before you use the formula at work, extend every range to the same last row. The example stops at row 8, so later rows won't count until you update the ranges. Check a second month by hand too, especially if your workbook mixes dates, text, blanks or different status spellings.

Ask for changes in normal words

Stay in the same chat and ask for what you want:

text
My Excel uses semicolons. Rewrite the formula for that.
text
Make it count the invoices instead of adding them up.
text
Change it to April and show me which rows count.
text
Here's the formula, the error I get and the row that should count: [paste them]. What's wrong?

If something looks off

It misses the last day of the month

Excel stores dates as numbers and times as fractions of a day. Ending the range at midnight on 31 March would miss the 80 invoice dated that afternoon. "Before 1 April" includes the whole last day. The formula uses SUMIFS, which adds values only when all the criteria match.

My dates might be text

A date-looking value can be text, and changing its display format doesn't prove it's a numeric Excel date. If you're not sure, ask how to check before you ask for the final formula. Microsoft explains how Excel stores dates and converts text.

Excel won't accept the formula

Check your version and separator first. Microsoft documents separator-related errors, and this example uses commas. Don't hide an error you can't explain with IFERROR just to get a tidy cell.

The total is wrong

Tell the AI the formula, the exact wrong result, and the made-up row that should behave differently.

Keep private details out

Use made-up rows, not payroll, bank details or customer records.

Sources

How we tested

We ran the step 1 prompt once in Claude Opus 5.5 on 18 October 2026. We checked the rows it chose and its total of 180 against our own hand calculation. Read the full answer.

Questions people ask

Do I need to upload my spreadsheet?

No. The column letters, data types, the rule you want and a few made-up rows were enough for this example.

Why won't Excel accept the formula?

Check the function names and the argument separator your Excel uses. This example uses English names and commas. Tell the AI your Excel version, language, separator and the exact error, with a made-up example.

Was the prompt tested in ChatGPT?

The test on this page used Claude Opus 5.5. You can paste the same prompt into ChatGPT.

Save it for later

Get this guide by email

Doing this on your computer later? We send you this page's link and its main prompt, then one short AI email a week. Unsubscribe any time.

Follow on Instagram@leverageai_io, where our Reels and code words are.
How to use ChatGPT for Excel formulas (with example)