How to Use ChatGPT to Write Excel Formulas
Describe the result you want in plain English — your column layout and one example — and ChatGPT returns a formula you paste into Excel and verify. Here is how to prompt it well, and how to check the formula before you trust it.
If you know the result you want but not the formula, ChatGPT is a fast way to get there. You describe the task in plain English, it writes the Excel formula, and you paste it into your sheet. The catch — and the part most guides skip — is that a formula from an AI is a draft, not a fact. This guide shows how to prompt it so the draft is usually right, and how to check it before you rely on it.
The basic workflow
- In plain English, describe what you want to calculate — and tell it exactly where your data is (which columns, starting row).
- Paste ChatGPT's formula into the correct cell in Excel.
- Test it on a few rows where you already know the answer.
- Ask ChatGPT to explain the formula if anything looks off, then adjust.
Write a prompt that gets the right formula
Vague prompts get vague formulas. The more of these you include, the better the result:
| Include | Example |
|---|---|
| The goal, in plain words | "Total sales, but only for the North region" |
| Your column layout | "Region is in column A, Sales in column B, rows 2 to 500" |
| A concrete example | "For North, the answer should be about 12,000" |
| Any conditions or edge cases | "Ignore blank rows; regions are text" |
A prompt like that typically returns a clean, correct formula — for the example above, a SUMIF such as =SUMIF(A2:A500, "North", B2:B500). Name the columns and give one expected answer, and you remove most of the guesswork.
Always verify before you trust it
This is the step that separates a useful workflow from a risky one. An AI can produce a formula that looks right but returns the wrong number — especially with complex or uncommon functions. Three quick checks catch almost every mistake:
- Test on known rows. Run it where you already know the answer and confirm it matches.
- Ask it to explain. "Explain this formula step by step" often exposes a wrong assumption about your data.
- Use Excel's own tools. Formulas tab > Evaluate Formula, or Trace Precedents, shows exactly what the formula is reading.
What it is good and bad at
ChatGPT is strong at translating a described task into a standard formula, fixing a formula you paste in, and explaining what an existing formula does. It is weaker on very complex, multi-step logic and on anything that depends on data it cannot see. For lookups, it is often quicker to learn the underlying function — see VLOOKUP and the IF function — so you can judge whether the AI's answer is sensible.
ChatGPT works from a text description; it does not touch your file. If you want an AI that reads the workbook and edits cells directly, that is a different class of tool — see our guide to the best AI tools for spreadsheets.
Frequently asked questions
Can ChatGPT read my Excel file?
The plain chat does not — it works from your written description, so it never sees your data. Paid tiers with file upload and data-analysis features can read an uploaded file, and separate add-ins (or Copilot in Excel) can work inside the workbook itself.
Do the same prompts work for Google Sheets?
Mostly. Many functions are shared, but a few differ, so tell ChatGPT which app you are using. If a formula returns an error in one app, ask it to rewrite the formula specifically for Excel or for Google Sheets.
Do I need ChatGPT Plus to write formulas?
No. Writing and explaining formulas works on the free tier, because it is a text task. Paid tiers mainly add file upload, data analysis, and higher limits, which help for larger or more complex work rather than for single formulas.
Why did ChatGPT's formula give the wrong answer?
Usually it misread your layout — wrong column, wrong start row — or assumed numbers where you have text. Re-state your exact ranges and data types, and test the result on rows where you already know the answer.