How to Write Google Sheets Formulas With ChatGPT or Claude

Write Google Sheets formulas with ChatGPT or Claude: a 5-step prompt method, working examples, and how to test and fix errors. Free to try, ~5 minutes.

By Archit Tamrakar · LinkedIn · · 9 min read

Quick answer: Tell the chat assistant your column letters, show it two or three sample rows, say what result you want, and ask for one Google Sheets formula. Paste it into a cell and check it by hand. Free? Yes, with a free Claude account (Google's built-in Gemini panel needs an eligible paid plan). Time: about 5 minutes.

Both ChatGPT and Claude work the same way for this job. The difference between a formula that works and one that breaks is almost always the quality of your description, not the tool.

What do you need before you start?

You need three things:

  • A Google Sheet with your data in rows and columns. A header row helps.
  • An AI chat account. Claude has a $0 Free plan, according to Anthropic's pricing page (as of 14 October 2026). ChatGPT works the same way; check OpenAI's own pricing page for its current plans.
  • A copy of your sheet. Test formulas on a copy or a spare tab so a bad formula cannot overwrite real data.

Optional: Gemini inside Sheets. Google says this requires an eligible Google Workspace or Google AI plan, so it is covered separately below.

How do you write a Google Sheets formula with ChatGPT or Claude? (Method 1: free chat assistant)

Use a chat assistant and a structured prompt. The five steps below take about five minutes.

  1. Open your Google Sheet and note the column letters and the row where data starts (for example, data in A2:D100).
  2. Copy two or three sample rows, including the header. Replace private details with made-up values.
  3. Open ChatGPT or Claude and paste this template, filled in:
I am using Google Sheets (not Excel).
My columns: A = Order date, B = Customer, C = Region, D = Amount.
Data starts in row 2. Here are three sample rows:
2026-09-01 | Acme Ltd | North | 250
2026-09-03 | Bright Co | South | 120
2026-09-05 | Acme Ltd | North | 310

Goal: In cell G2, show the total Amount for the region typed in F2.
Give me one formula, explain each part in one sentence,
and tell me what result it should return for my sample rows.
  1. Read the answer. In your sheet, click the target cell (G2 in this example), paste the formula, and press Enter.
  2. Compare the result with the number you worked out by hand from the sample rows. If they match, copy the formula down or across.

The last line of the prompt matters. Asking the assistant to state the expected result gives you something to check against.

What should you put in the prompt?

Include the following every time:

ItemWhy it mattersExample
"Google Sheets, not Excel"Some Excel functions and syntax differ"I am using Google Sheets"
Column letters and headersThe formula needs exact references"A = Date, B = Customer"
First data rowAvoids pulling in the header"Data starts in row 2"
Sample rowsShows the real format of dates and numbersThree rows, anonymised
Output cellTells it where the formula lives"Put the result in G2"
Expected resultLets you verify it"Should return 560"

What formulas can the assistant write for you?

It can write any function in the Sheets library. These are the ones readers most often ask for, with the syntax Google documents for each.

JobFunctionGoogle's syntax
Look up a value in another columnXLOOKUPXLOOKUP(search_key, lookup_range, result_range, missing_value, match_mode, search_mode)
Older lookup, still commonVLOOKUPVLOOKUP(search_key, range, index, [is_sorted])
Filter rows by a conditionFILTERFILTER(range, condition1, [condition2, ...])
Run a database-style queryQUERYQUERY(data, query, [headers])
Fill a whole column from one cellARRAYFORMULAARRAYFORMULA(array_formula)
Replace an error with a messageIFERRORIFERROR(value, [value_if_error])

Here are three prompts and the kind of formula they should produce, using the sample columns above (A = Order date, B = Customer, C = Region, D = Amount). The formulas are illustrations built from the documented syntax. Test each one on your own data.

Prompt: "Total Amount for the region in F2."

=SUMIF(C2:C100, F2, D2:D100)

Prompt: "Show only rows where Region is North and Amount is over 200."

=FILTER(A2:D100, C2:C100="North", D2:D100>200)

Prompt: "Look up the Amount for the customer typed in F2, and show 'Not found' if they are missing."

=XLOOKUP(F2, B2:B100, D2:D100, "Not found")

In Google's own example, XLOOKUP("Apple", A2:A, E2:E) replaces VLOOKUP("Apple", A2:E, 5, FALSE). That means you no longer count column numbers by hand, which is a common source of wrong answers.

How do you get a formula for a whole column at once?

Ask for an ARRAYFORMULA version. Google's page gives the syntax as ARRAYFORMULA(array_formula), with ARRAYFORMULA(A1:C1+A2:C2) as an example. One formula in the top cell then fills the column, so you do not need to drag it down.

A prompt that works: "Rewrite this as one ARRAYFORMULA in E2 that fills down for every row where column D is not empty." The assistant will usually wrap the formula in IF(D2:D<>"", ..., "") so blank rows stay blank. Check that new rows added at the bottom are picked up.

Method 2: Can Gemini inside Google Sheets write the formula?

Yes, if your account has access. Google's help page says "You can use Gemini to generate formulas in Sheets", and that the feature requires an eligible Google Workspace or Google AI plan.

  1. Open your spreadsheet in Google Sheets.
  2. At the top right, click Ask Gemini.
  3. In the side panel, type a prompt using references from your sheet or generic cell names. Google's example is "Create a formula that divides goals by games."
  4. Click the cell where you want the formula, then click Insert.
  5. If the result is not right, click Retry to see a different version.

Google also lists a shortcut: type = in a cell, then press Ctrl + Alt + g on Windows or ChromeOS, or ⌘ + Ctrl + g on Mac.

The advantage is that Gemini works inside the sheet, so you do not copy and paste between windows. The disadvantage is the plan requirement. Google adds that the feature works best with native Google Sheets files, so for an .xlsx file use File > Save as Google Sheets first.

Method 3: How do you fix a formula that shows an error?

Paste the formula and the exact error back to the assistant and ask for a Google Sheets fix. If you have Gemini, you can also hover over the cell with the error and click Fix. Google says Gemini then reviews the formula and analyzes the issue.

Use a prompt like this:

This formula in Google Sheets gives #ERROR!:
=SUMIF(C2:C100; F2; D2:D100)
My columns: C = Region, D = Amount, F2 = the region to total.
Explain what is wrong and give me the corrected formula.

Semicolons instead of commas are one common cause. Some regional settings use different separators, so tell the assistant your country or locale if the formula keeps failing.

To hide an error you expect (such as a missing lookup), wrap the formula in IFERROR. Google's page shows IFERROR(A1,"Error in cell A1"), and says it is logically equivalent to IF(NOT(ISERROR(exp1)),exp1,exp2). Use it sparingly: it can also hide real mistakes.

Which method should you choose?

MethodCostDifficultyLimitsBest for
ChatGPT or Claude chatFree tier available (Claude Free is $0 as of 14 Oct 2026)EasyCannot see your sheet; you paste samplesMost people, one-off formulas
Gemini in SheetsNeeds eligible Workspace or Google AI planEasyPlan required; history lost on reloadTeams already on Workspace
Chat assistant plus error textSame as chatEasyNeeds the exact error messageFixing a broken formula

For related setups, see How to Use ChatGPT Inside Google Sheets and How to Use Claude in Google Docs, Sheets and Slides.

What's free and what costs money?

As of 14 October 2026:

  • Claude Free: $0, with Sonnet and Haiku models. Anthropic's pricing page says there is no fixed message count and that limits reset on a rolling five-hour window. Pro is $20 billed monthly, or $17 a month with the annual discount ($200 billed up front). Prices exclude tax and can change, the company says.
  • Claude usage varies. Anthropic's usage limit article lists message length, attachment size, conversation length and model choice among the factors. Short formula questions with a few sample rows use little.
  • ChatGPT: plans and limits are on OpenAI's pricing page. Check it before you plan a heavy session.
  • Gemini in Sheets: requires an eligible Google Workspace or Google AI plan, according to Google.
  • Google's function reference pages: free.

What can go wrong, and how do you fix it?

  1. The formula shows #ERROR! Usually a missing comma, unmatched bracket or wrong separator. Paste the error back to the assistant, or use Fix if you have Gemini.
  2. The formula is an Excel formula. Start every prompt with "Google Sheets, not Excel". If a function is not recognised, ask for a Sheets equivalent.
  3. The answer is wrong but there is no error. For VLOOKUP, Google's page notes the default for is_sorted is TRUE (approximate match) and recommends FALSE for an exact match. Ask the assistant whether any argument changes exact versus approximate matching.
  4. The range is wrong. The assistant guesses ranges if you do not give them. State the first and last data row, or ask for open-ended ranges such as A2:A.
  5. Numbers stored as text. Dates or amounts pasted from other systems may not calculate. Tell the assistant what a sample cell looks like.
  6. The formula returns nothing after you add rows. A fixed range like D2:D100 ignores row 101. Ask for an open-ended range or an ARRAYFORMULA.

Is this allowed?

Using an AI assistant to write formulas for your own spreadsheet is a normal use of these tools. The risk is what you paste in.

  • Do not paste personal or confidential data that you are not allowed to share with a third-party service. Anonymised sample rows are enough.
  • Check your workplace policy. Some employers restrict which AI tools staff may use with company data.
  • Gemini and sharing. Google's page warns that on shared or external spreadsheets, content added by Gemini may be visible to users outside your domain.
  • Do not rely on it for professional advice. Google says Gemini suggestions may be inaccurate and should not be relied on as medical, legal, financial or other professional advice. The same caution applies to any assistant if your formula feeds into invoices, payroll or tax figures.

What's still unclear?

  • ChatGPT limits. OpenAI's usage limits for free and paid plans change often. Check OpenAI's pricing page.
  • Claude's exact free allowance. Anthropic says there is no fixed message count, so no one can promise how many formula requests fit in one window.
  • Accuracy. AI-written formulas can be wrong. The safe habit is to test every formula against a result you worked out by hand.

If your formulas will pull in live data, see How to Pull API Data Into Google Sheets. If the finished sheet should trigger email, see How to Send Emails From Google Sheets Automatically.

Last checked: 14 October 2026.

Frequently asked questions

Can ChatGPT or Claude write Google Sheets formulas for me?

Yes. You describe your columns and the result you want in plain English, and the assistant replies with a formula you paste into a cell. It cannot see your spreadsheet unless you paste in sample rows, so the clearer your description, the better the formula. Always test the result on a few rows you can check by hand before relying on it.

Why does the formula the AI gave me show #ERROR!?

The most common causes are a missing comma or bracket, a function name that does not exist in Sheets, or a formula copied from Excel. Paste the formula and the exact error text back into the chat and ask for a Google Sheets version. If you have Gemini in Sheets, you can also hover over the error cell and click Fix.

Is it free to get formulas from an AI assistant?

Claude has a $0 Free plan, and Google's formula reference pages are free. Anthropic says Free has no fixed message count and limits reset on a rolling five-hour window, as of 14 October 2026. Gemini inside Sheets needs an eligible Google Workspace or Google AI plan, according to Google's help page.

Should I paste my real data into the chat?

Paste only what you need. Three or four sample rows with the real column layout are enough for the assistant to write a formula. Replace names, emails, account numbers and anything private with made-up values. The formula depends on the structure of your data, not on the actual contents.

What is the difference between VLOOKUP and XLOOKUP in Sheets?

Both find a value in one column and return a matching value from another. Google's documentation shows XLOOKUP(search_key, lookup_range, result_range) replacing a VLOOKUP that needs a column number, and XLOOKUP can return a value from a column to the left of the match column. VLOOKUP defaults to approximate matching unless you pass FALSE.

Sources

  1. Collaborate with Gemini in Google Sheets, Google Docs Editors Help (2026-10-14)
  2. QUERY function, Google Docs Editors Help (2026-10-14)
  3. ARRAYFORMULA, Google Docs Editors Help (2026-10-14)
  4. VLOOKUP, Google Docs Editors Help (2026-10-14)
  5. XLOOKUP function, Google Docs Editors Help (2026-10-14)
  6. IFERROR, Google Docs Editors Help (2026-10-14)
  7. FILTER function, Google Docs Editors Help (2026-10-14)
  8. Claude pricing, Anthropic (2026-10-14)
  9. Usage limit best practices, Anthropic Help Center (2026-10-14)