AI Tools

AI Tools › Guides › Excel formulas with ChatGPT

How to Use ChatGPT to Write Excel Formulas

ChatGPT can suggest a formula from a description of your spreadsheet.

In short

The quality of the answer depends on how precise your description is, and you must always test the result.

  1. Describe the structure of the sheet
  2. Say what you want to get
  3. State your Excel version
  4. Ask for the formula, then an explanation
  5. Test on 2 or 3 rows

Many people lose time because they know what they want from Excel (“add up one customer's sales for a given month”) but not how to write it. An AI is useful here: it turns a sentence into a formula, then explains each piece. It can't see your file unless you give it, so everything depends on the quality of your description.

How to do it

  1. Describe the structure of the sheet: which columns (letter and heading), which row the data starts on, what kind of content (dates, amounts, text).
  2. Say what you want to get, with a numeric example taken from your data.
  3. State your Excel version and language. Some recent functions are not available everywhere: according to Microsoft's page, XLOOKUP is not available in Excel 2016 and Excel 2019.
  4. Ask for the formula, then an explanation of each argument in one sentence.
  5. Test on 2 or 3 rows whose right answer you know, then extend to the whole sheet.

Two formulas to know

Here are two functions whose syntax was taken from Microsoft's support site. They serve as a reference for checking what ChatGPT suggests.

FunctionOfficial syntaxWhat it does
XLOOKUPXLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])Find in a table the item that matches a value (for example the price of a product code).
SUMIFSSUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)Add the values that meet several conditions at once.

In XLOOKUP, the optional if_not_found argument lets you show text of your choice instead of the #N/A error when nothing matches. In SUMIFS, the range to add comes first.

Separator: depending on your language and regional settings, Excel expects either commas or semicolons between arguments. If a formula is rejected, try the other separator.

A complete prompt to copy

You are an Excel expert who explains things simply.
My data is in the sheet "Sales". Headings are in row 1, data starts in row 2.
Column A: sale date. Column B: customer name. Column C: product. Column D: amount in dollars.
In another sheet, "Customers", column A contains the customer name and column C contains their email address.
I want, in the "Sales" sheet, a column E that shows the email address of the customer on each row, and the text "unknown customer" if the name is not in the "Customers" sheet.
I use Excel for Microsoft 365 in English.
Give me the formula to type in E2, explain each argument in one sentence, then tell me how to copy it down to the last row.
Finish with two common errors that might appear and how to fix them.

A second example: calculate with several conditions

In the "Sales" sheet (headings in row 1, data from row 2 to row 500), column B contains the customer, column C the product, column D the amount.
I want the total of the amounts for the customer written in cell G1 AND for the product written in cell G2.
Write the formula for English-language Excel, explain it, and suggest a variant that counts the number of sales instead of adding them up.
If my request is ambiguous, ask me your questions first.

When you have a file rather than a description

According to OpenAI's help page consulted on Nov 23, 2026, ChatGPT accepts spreadsheets (XLSX, XLS, CSV, TSV, ODS), with a limit of about 50 MB depending on row size, and free accounts are limited to 3 file uploads per day. Limits can change: check the help page. Before uploading a file, remove personal and confidential data (customer names, addresses, salaries, internal figures) or replace them with fictional examples. A description of the columns with three made-up rows is often enough to get a good formula.

Mistakes to avoid

Going further

To structure your requests, use our prompt generator. If your text contains strange characters after a copy and paste, try the ChatGPT text cleaner. Everyday admin tasks are also covered in our prompts for administrative assistants.

Frequently asked questions

Can ChatGPT read my Excel file?

According to OpenAI's help page, it accepts XLSX, XLS, CSV, TSV and ODS formats, with size and upload limits that depend on your plan. Don't send it confidential data.

Why doesn't the suggested formula work?

Common causes: a poorly described column, a function missing from your Excel version, or the wrong argument separator (comma or semicolon). Paste the exact error message into the conversation.

Is XLOOKUP available in every version of Excel?

No. Microsoft's help page says it is not available in Excel 2016 and Excel 2019. Check in your version.

Should I trust the result?

No, check it. Test the formula on a few rows whose answer you know before extending it to the whole sheet.

Sources: Microsoft: XLOOKUP function · Microsoft: SUMIFS function · OpenAI Help Center: file uploads FAQ. Guide updated on November 23, 2026.

Free tools to go faster

Ready-to-copy prompts

On the same topic

Read next

All guides · All tools