Spreadsheets

Spreadsheet formulas with AI: Google Sheets and Excel

Ask an AI chat tool to explain or write a formula, then test it on three rows before you trust it.

By Laner Labs Learning teamPublished Updated 4 min read

A spreadsheet with a formula and a chart

You can ask an AI chat tool to explain a formula or to write one from a plain description. The safe method has three steps. Describe your columns with made-up data, ask for the formula, then test it on three rows where you already know the answer. This article walks through that method and the errors beginners meet most often.

Describe your sheet, not your real data

The tool does not need your real file. It needs to know what is in each column. Write the layout as text, with three or four invented rows. Say which program you use, because Google Sheets and Excel can differ.

Made-up table, in a note you type into the chat:

  • Column A: Item. Column B: Team. Column C: Amount.
  • Row 2: Pens, Sales, 20
  • Row 3: Paper, Admin, 35
  • Row 4: Pens, Admin, 15

Ask for an explanation first

If you inherited a formula, paste only the formula, not the data. Prompt: "Explain this [Google Sheets or Excel] formula in plain words, one part at a time: [formula]." Then check the explanation against the official help page for each function.

Ask for a formula in plain language

Prompt: "I use [Google Sheets or Excel]. Column A is Item, column B is Team and column C is Amount, from row 2 down. Write a formula that adds the amounts where Team is Admin. Explain each part."

A likely answer is a SUMIF formula such as =SUMIF(B2:B4,"Admin",C2:C4). The official Microsoft and Google pages both list SUMIF with a range, a criterion and an optional sum range. The Google page notes it handles only one condition.

Test it on three rows

  1. Use a tiny table where you can add the answer in your head. Here, Admin amounts are 35 and 15, so the answer should be 50.
  2. Type the formula and compare the result with your own sum.
  3. Change one value, such as 35 to 40. The result should move to 55. If it does not, the ranges are wrong.
  4. Add a row with a different team. The result should not change.
  5. Only then apply the formula to your real sheet, with your real ranges.

Common problems and what to try

  • Wrong result: check that the ranges cover the same rows. Microsoft notes that a sum range of a different size can give unintended results.
  • Text not matching: text conditions go inside double quotation marks, as in "Admin". Extra spaces in cells can also stop a match.
  • Error codes: Microsoft lists errors such as #N/A, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME? and #NULL!. Read the error, then ask the tool what it usually means, and confirm on the help page.
  • Hiding errors: IFERROR(value, value_if_error) returns your chosen result when a formula errors. Use it carefully, because it can hide a real mistake.
  • Lookup surprises: Google documents VLOOKUP as VLOOKUP(search_key, range, index, is_sorted). It recommends FALSE for an exact match, so check that setting.

What AI tools inside spreadsheets can and cannot promise

Both Google and Microsoft offer ways to use AI inside their products. Availability, names and plans change and can depend on your account or employer. I could not confirm current details for this article, so check the official help pages for your own product. Whatever tool you use, the same test applies: try it on rows you can check.

A second worked example: a lookup

Suppose you have a small made-up price list on one tab. Column A holds product codes and column B holds prices. On another tab you type a code and want the price. Prompt: "I use [Google Sheets or Excel]. Prices are in Sheet2, columns A to B, from row 2. Write a formula that finds the price for the code in A2 on this sheet. Show an exact match."

The tool may suggest VLOOKUP with FALSE for an exact match. Test it with a code you know, such as one priced at 12, and with a code that does not exist. The second test should show an error. That is the right result, because the code is not in the list. Do not hide it until you understand why.

Questions to ask the tool after it gives a formula

  • "What would make this formula give a wrong answer?"
  • "What happens if a cell is empty, or holds text instead of a number?"
  • "Is there a simpler way to do this for a beginner?"
  • "Does this work the same way in both Google Sheets and Excel?"

Treat the replies as ideas to test, not as facts. When the tool names an unfamiliar function, find it on the official help page and read the syntax there.

Habits that prevent mistakes

  • Keep the original file. Work on a copy while you try new formulas.
  • Change one thing at a time, and test after each change.
  • Label your made-up test table so nobody mistakes it for real data.
  • Write a short note beside a complex formula that says what it does.

Keep your information safe

Do not type personal or confidential information into an AI tool unless your employer or you have approved it for that data. Spreadsheets often hold customer lists, salaries, bank details and IDs. Use made-up rows. Check every formula before you rely on it.

Official pages to check

  • Official pages to check: support.google.com/docs (SUMIF, VLOOKUP, error messages in Google Sheets) and support.microsoft.com (SUMIF and IFERROR in Excel). Read the page for the function you use.

Good to know

Keep a "test" tab with your tiny table. Paste new formulas there first.

Our spreadsheet course lets you practise this method on safe sample files.

Common questions

Can AI write a spreadsheet formula for me?

Often yes, but it can be wrong. Give it a clear description and a small made-up table, then test the formula on a few rows where you already know the answer.

Do I need to paste my real data?

No. Describe your columns and use three or four made-up rows. Real customer, staff or financial data should not go into an AI tool unless it has been approved for that data.

Do Google Sheets and Excel use the same formulas?

Many common ones, such as SUMIF, work in both with the same shape. Details can differ, so check the official help page for your product.

Official pages to check

AI tools change quickly. Check the vendor's current help page before you act, and review anything an AI tool produces before you rely on it.

Share this article