ChatGPTBeginner

How to Build an Excel or Google Sheets Formula With ChatGPT

Describe what you want a cell to do in plain English and get a working formula you can paste straight in.

6 minBeginner

Nested IFs, VLOOKUP, INDEX MATCH, the syntax never sticks. Instead of fighting it, describe the result you want and let ChatGPT write the formula. It works for both Excel and Google Sheets, but you have to tell it which one because the function names differ.

  • Which app you use (Excel or Google Sheets)
  • Your column layout and what is in each column
  • An example of the input and the output you expect

Step 1: Describe your sheet layout

The model cannot see your sheet, so tell it where things are. Name the columns and give a sample row. Vague requests get formulas that reference the wrong cells.

prompt.txt
Google Sheets. Column A has sale dates, column B has amounts.
In cell D2 I want the total of all amounts where the date in A is in the current month.
Give me one formula and explain each part briefly.

Step 2: Paste the formula and test one cell

Copy the formula into the target cell and check the result against a value you can compute by hand. Do not roll it out across a thousand rows until one cell is proven correct.

D2
=SUMIFS(B:B, A:A, ">="&EOMONTH(TODAY(),-1)+1, A:A, "<="&EOMONTH(TODAY(),0))
Google Sheets
A B C D
1 Date Amount Month total
2 2026-06-03 120.00 1,340.00
3 2026-06-11 90.00
4 2026-05-28 50.00 (excluded: last month)
Paste the formula into D2 and confirm the total looks right.

Step 3: Ask it to explain so you can maintain it

A formula you do not understand is a future bug. Ask the model to break down each argument. For the example above, EOMONTH(TODAY(),-1)+1 is the first day of this month and EOMONTH(TODAY(),0) is the last, so SUMIFS adds only this month's amounts.

ChatGPT - Explanation
You
Explain the EOMONTH parts of that formula.
Agent
EOMONTH(TODAY(),-1) is the last day of last month; adding 1 gives the first day of this month. EOMONTH(TODAY(),0) is the last day of this month. So the two conditions keep only rows whose date falls inside the current month.

Step 4: Handle the edge cases

Tell it what should happen with blanks, errors, or text in a number column. Ask wrap this so blank cells count as zero and errors show a dash. This is where hand-written formulas usually break and where the model saves you the most time.

Name your app every time
Excel uses semicolons in some regions and Google Sheets has functions Excel lacks. Stating the app and even your locale upfront stops the model from handing you a formula that throws a parse error on paste.

Result

You describe the calculation in one sentence, get a working SUMIFS formula, understand each piece, and harden it against blanks. No more trial-and-error with parentheses.

Watch related tutorials

Tags
#spreadsheet#excel#formulas#productivity