Back to blog
automation·June 18, 2026·7 min read·By Yehonatan Saadia

How to Write Excel and Google Sheets Formulas With ChatGPT

A beginner guide to write Excel formulas with ChatGPT: describe the result in plain words, get the formula plus an explanation, fix errors, and copy-paste examples for VLOOKUP, XLOOKUP, and SUMIFS.

If you have ever stared at a spreadsheet knowing exactly what answer you want but not which formula gets you there, this guide is for you. The good news in 2026 is that you no longer need to memorize function names or argument order. You can write Excel formulas with ChatGPT by describing the result in plain English, and it hands you the formula plus an explanation of how it works. I use this every week, and below I will show you exactly how, with copy-paste prompts and real before-and-after examples for the formulas people ask about most: VLOOKUP, XLOOKUP, and SUMIFS.

How to write Excel formulas with ChatGPT

The whole trick is to stop thinking like a programmer and start describing the outcome. ChatGPT translates plain language into the correct formula far better than most people expect. Here is the core move: tell it what your columns contain, what answer you want, and whether you are in Excel or Google Sheets.

Here is a prompt you can copy and adapt right now:

I'm using Excel. My data is in a sheet where:
- Column A has the customer name
- Column B has the region (North, South, East, West)
- Column C has the sale amount in dollars

I want a formula in cell E2 that adds up the total sales for the North region only. Give me the formula and explain it in one sentence.

That prompt gets you a working SUMIFS (or SUMIF) formula and a plain explanation. Notice what made it work: I named the columns, said what each one holds, stated the exact result I wanted, and told it Excel rather than Sheets. The more specific you are, the less back-and-forth you need.

Tell it Excel or Google Sheets

This matters more than beginners expect. Excel and Google Sheets share most functions but differ in small ways. Google Sheets sometimes wants semicolons instead of commas depending on your locale, and a few functions exist in one but not the other. If you do not say which tool you use, you might get a formula that works for someone else and throws an error for you. One word up front saves you a debugging trip.

A worked before-and-after example

Let me show you the full loop with a real case. Say you have a list of orders and you want to pull the price of a product by its code.

Before (what I typed):

I'm using Google Sheets. I have product codes in column A and prices in column B on a tab called Catalog. On another tab I have a product code in cell A2. I want a formula that finds the matching price from the Catalog tab. Give me both a VLOOKUP version and the newer XLOOKUP version, and tell me which is better.

After (what I got back, cleaned up):

VLOOKUP version:
=VLOOKUP(A2, Catalog!A:B, 2, FALSE)

XLOOKUP version:
=XLOOKUP(A2, Catalog!A:A, Catalog!B:B)

The explanation it gave: VLOOKUP looks for the value in A2 down the first column of the Catalog range and returns the value from the second column, with FALSE forcing an exact match. XLOOKUP does the same but lets you point at the lookup column and the result column separately, so it does not break if you insert a column in the middle. It recommended XLOOKUP when available because it is more robust. That is exactly the kind of judgment a beginner does not have yet, and it comes free with the formula.

The three formulas people ask for most

Here is a quick reference for the lookups and sums that come up constantly, with the kind of plain request that gets each one.

What you wantAsk ChatGPT forRoughly what you get
Find a value in a table by a key"Look up the price for this product code"VLOOKUP or XLOOKUP
Same, but newer and more flexible"Use XLOOKUP so it survives column changes"XLOOKUP
Sum numbers that meet a condition"Total the sales where region is North"SUMIF or SUMIFS
Sum with two or more conditions"Total sales for North in January"SUMIFS
Count rows that meet a condition"Count how many orders are over $500"COUNTIF or COUNTIFS

You do not need to know which function applies. Describe the result and let the tool pick. If you are curious, ask it why it chose that function over an alternative, and you will slowly learn the patterns yourself.

Fixing errors is where ChatGPT really shines

Beginners often give up when a formula returns #N/A or #REF!. That is the easiest part to fix with AI. Copy the exact error and the formula back into the chat. A prompt like this works every time:

This formula gives me a #N/A error:
=VLOOKUP(A2, Catalog!A:B, 2, FALSE)

The product code in A2 looks correct and it exists in the Catalog tab. Why is it failing and how do I fix it?

Common culprits it will catch: a stray space in the code, a number stored as text, the lookup column not being the leftmost in the range, or a typo in the tab name. It will hand you a corrected formula and often wrap it in IFERROR so a missing match shows a friendly message instead of an ugly error. That single habit, pasting the error back, will save you more time than anything else in this guide.

Caveats: check the output before you trust it

AI is a fast assistant, not an oracle. A few honest limits to respect.

  • Always test on a known row. Run the formula on a row where you already know the answer by hand. If it matches, trust it on the rest. If not, paste the mismatch back and ask why.
  • It can be confidently wrong. Large language models sometimes invent a function name or get an argument order slightly off, especially for obscure cases. Verifying against a known result catches this in seconds.
  • Mind your data privacy. Do not paste customer names, emails, financial records, health data, or anything regulated into a consumer chat tool. Describe the structure instead, or replace real values with fake samples. The formula does not care whether the name is real.
  • Locale and version quirks. If a formula errors on separators, tell ChatGPT your region or that your Sheets uses semicolons, and it will adjust.

Used this way, writing formulas stops being a barrier. You stay in charge of the logic and the checking, and the AI handles the syntax you would otherwise have to look up.

When to keep going further

Once you are comfortable with formulas, the natural next step is letting AI work with the whole spreadsheet, not just one cell. You can upload a file and ask it to clean, pivot, and chart your data. I cover that in how to analyze Excel data with ChatGPT. And if you find yourself rebuilding the same formulas in a new file every week, that is a sign the task is ready to be automated, which I talk through in when to stop doing it manually and automate it.

Doing it once by hand is great. Doing it weekly is a job for automation.

Writing a one-off formula with ChatGPT is a genuinely useful skill, and for a quick answer it is perfect. But if you are pasting the same lookup into a fresh export every Monday, copying results into a report, and emailing it out, you are doing a robot's job by hand. That recurring loop is exactly what I automate for clients: the data gets pulled, cleaned, calculated, and delivered without you touching a cell.

If a spreadsheet task is eating an hour of your week on repeat, book a call and I will tell you honestly whether it is worth automating and what that would take. You can also reach me through the contact form. For the bigger picture on what is worth handing off, see my guide to business automation for small business.

#excel formulas#chatgpt#google sheets#spreadsheets#ai for business

Frequently asked questions

Can ChatGPT really write Excel formulas if I don't know the function names?

Yes. You describe the result you want in plain language, name your columns, and say whether you use Excel or Google Sheets. ChatGPT picks the right function, such as VLOOKUP, XLOOKUP, or SUMIFS, and returns the formula with an explanation. You never need to know the function name in advance.

What do I do if the formula gives an error?

Copy the exact error message, such as #N/A or #REF!, together with the formula, and paste both back into the chat asking why it failed. ChatGPT reads the error and usually returns a corrected version, often wrapped in IFERROR so missing matches show a clean message instead of an error.

Is it safe to paste my spreadsheet data into ChatGPT?

Avoid pasting real customer names, emails, financial records, or any regulated or personal data into a consumer chat tool. You don't need to. Describe the structure and column letters, or use fake sample values. The formula works the same whether the data is real or made up.

Does this work for Google Sheets too, or only Excel?

It works for both. Just state which one you use, because they differ in small ways like argument separators and a few function names. If you say Google Sheets up front, ChatGPT returns a formula that pastes in cleanly instead of one tuned for Excel.

Should I always trust the formula ChatGPT gives me?

Test it first. Run it on a row where you already know the correct answer by hand. If it matches, you can trust it on the rest of the data. AI can occasionally be confidently wrong about argument order or function names, and a quick check against a known result catches that in seconds.

Keep reading

About the author

Yehonatan Saadia

Freelance automation, web & MVP engineer

I'm Yehonatan Saadia, a senior engineer who builds business automation, custom websites, and MVPs for small and mid-sized companies across the US, Europe, and Israel. These guides come from real client work, not theory.

Work with me

Have a project like this?

Tell me what you're trying to automate or build and I'll tell you the fastest reliable way to ship it.