Key takeaways
- ChatGPT writes better Excel formulas when you give it the sheet name, column letters, header row and your Excel version before asking the question.
- ChatGPT can read uploaded .xls, .xlsx and CSV files, but its checks run in Python, so every formula still needs testing on known rows inside Excel.
- For #N/A, #NAME? or #SPILL! errors, paste the exact error and a failing row back into ChatGPT and use Formulas > Formula Auditing > Evaluate Formula to find the broken step.
In this story 6 sections
You know what the spreadsheet should do. You just can't remember whether it's SUMIFS or COUNTIFS, or why your XLOOKUP keeps returning #N/A. That is the sweet spot for learning how to use ChatGPT for Excel formulas: you describe the result in plain English, it writes the formula, and you check it against your real data. This guide is for anyone who works in Excel but doesn't write formulas every day. Plan on about 15 minutes for the first one, and a minute or two after that.
Before you start
- Have the workbook open and know the exact column letters, header names and sheet names you'll reference.
- Note your Excel version. Microsoft 365 has newer functions like XLOOKUP that older versions such as Excel 2016 don't.
- Strip or replace anything confidential (names, account numbers, salaries) before you paste rows or upload a file.
- Keep a copy of the file, so a bad formula can't damage the original.
Describe your sheet so ChatGPT can write a formula that fits
- Open ChatGPT on the web, the desktop app or your phone. A free account is enough for formula help.
- Start with the layout, not the question. Say which sheet you're on, which columns hold what, which row the data starts on, and where the answer should go. For example: "Sheet 'Sales'. Column A is Region, B is Order Date, C is Amount. Headers in row 1, data in rows 2 to 500."
- Tell it your Excel version and your platform (Windows, Mac or Excel for the web). That steers it away from functions you don't have.
- Paste five to ten sample rows if the logic depends on the data itself, such as text with extra spaces or dates stored as text. Fake values are fine as long as the format matches.
If you want ChatGPT to remember your setup between chats, add a line like "I use Excel for Microsoft 365 on Windows" to your ChatGPT custom instructions.
Ask for the formula in plain English
- State the result you want, including the edge cases. "In E2, total the Amount for the West region for orders on or after January 1, 2026. If there are none, show 0."
- Ask for one formula and a short explanation of each part. A good reply for the example above looks like this: =SUMIFS(C:C,A:A,"West",B:B,">="&DATE(2026,1,1))
- Ask what should happen with blanks, errors and duplicates. Most broken formulas fail on the rows nobody thought about.
- For lookups, ask for a version with a fallback. For instance: =XLOOKUP(A2,Products!A:A,Products!C:C,"Not found") returns a readable message instead of #N/A. Microsoft's own overview of formulas in Excel recommends XLOOKUP over the older VLOOKUP.
- If the formula is long, ask for a simpler version first. Nested logic is easier to trust when you can follow it.
The phrasing tips in our guide on how to write better AI prompts apply here too: be specific about the goal, the format and the constraints.
Upload the workbook when the data is messy
Sometimes you can't describe the problem without showing it. ChatGPT accepts Excel files (.xls and .xlsx) and CSV files, according to OpenAI's data analysis help article.
- Attach the file in the chat and say which sheet and columns matter.
- Ask two separate things: "Write the Excel formula I should put in F2" and "Check it against the first 20 rows and show me what it returns."
- Compare its sample results with what you see in Excel. When ChatGPT analyzes a file, it typically runs Python code behind the scenes, so its numbers come from that code rather than from Excel itself. The formula you paste still needs to be tested in your workbook.
OpenAI's file uploads FAQ lists a limit of roughly 50 MB for spreadsheets and CSV files, and it caps free users at a small number of uploads per day. For large or sensitive files, describing the layout and pasting a few anonymized rows is usually the better route. Our guide to uploading a PDF to ChatGPT covers the same privacy trade offs.
Paste the formula and test it in Excel
- Click the destination cell, paste the formula into the cell or the Formula Bar, and press Enter.
- Test it on rows where you already know the answer. Total three rows by hand and see whether the formula agrees.
- Fill it down only after the first cell is right, then spot check a few rows near the bottom.
- Check your argument separator. Microsoft notes that Excel uses a comma or a semicolon between arguments depending on your location settings. If ChatGPT gives you commas and your Excel expects semicolons, swap them or ask ChatGPT to rewrite it.
- Watch for absolute references. If a cell like $H$1 should stay fixed when you copy the formula, make sure the dollar signs are there.
Fix a formula that throws an error
When the formula breaks, don't just say "it doesn't work." Give ChatGPT the formula, the exact error (#N/A, #VALUE!, #NAME?, #SPILL!), and one example row that fails.
- #NAME? usually means a misspelled function or one your version doesn't have. Ask for an alternative that works in your version.
- #N/A in a lookup often means the values don't match exactly, such as extra spaces or numbers stored as text. Ask for a version that wraps the lookup value in TRIM or VALUE.
- #SPILL! means a dynamic array formula needs empty cells below or beside it. Clear the cells in its way.
To see where a nested formula goes wrong, use Excel's built in tool: Formulas > Formula Auditing > Evaluate Formula, which Microsoft describes in its guide to detecting formula errors. It walks through the calculation one step at a time, and you can paste the step that fails back into ChatGPT.
When ChatGPT keeps getting it wrong
If you've gone three rounds and the formula still fails, the problem is usually the description, not the tool. Start a fresh chat, restate the layout from scratch, and include a small example table with the answer you expect for each row. Showing the target output often fixes what a paragraph of explanation can't.
ChatGPT can also sound sure of itself while inventing a function or mixing up argument order. Treat every formula as a draft until it matches numbers you've checked yourself. The habits in our piece on checking AI answers before you trust them apply to spreadsheets as much as research.
If your company pays for Microsoft 365 Copilot, you may not need to leave Excel at all. Microsoft says you can open Copilot from the icon in the lower right corner of Excel and ask it to generate formulas, though it depends on your subscription and your organization's settings, per its get started with Copilot in Excel page. One change to know about: Microsoft retired the separate COPILOT worksheet function on September 14, 2026, and cells that used it now show #NAME? when they recalculate.
A final check before you share the file: click into one cell the formula fills, read it in the Formula Bar, and make sure you can explain each part in a sentence. If you can, you own the formula. If you can't, ask ChatGPT to walk you through it once more. For more guides like this one, browse our AI section.
Sources
Share this story
Spotted an error? Tell us


