How to Use AI to Write Excel Formulas (Free, With Copy-Paste Prompts)
You don't need to memorize XLOOKUP or nested IFs anymore. Describe what you want in plain English and an AI assistant will write the formula, explain it, and fix it when it breaks. The catch: it only works well if you tell it how your sheet is laid out, and you should test the result on a few rows before you copy it down.
Step 1: Pick a tool (no special "formula generator" needed)
Searches for "AI Excel formula generator" turn up lots of single-purpose sites, many asking you to sign up. A free general assistant does the same job:
- A general chat assistant such as Grok, ChatGPT, Claude, Gemini or Microsoft Copilot. Free plans are enough for formulas (limits change, so check the tool's own page).
- The assistant inside your spreadsheet. Copilot in Excel and Gemini in Google Sheets can see your actual columns, which saves describing them, but they usually need a paid plan or a work license.
At work: use the AI tool your company approves, and don't paste customer names, salaries or other confidential rows into a personal account. You rarely need real data anyway; column headers and a couple of made-up example rows are enough.
Step 2: Describe your sheet, then ask
Most bad AI formulas come from the AI guessing where your data is. Paste this and fill in the brackets:
Write an [Excel / Google Sheets] formula that [what you want, e.g. "shows the total sales for each salesperson"]. My data is in columns [A to D] with headers in row 1: [A = Date, B = Salesperson, C = Region, D = Amount]. Rows go down to about [500]. Put the result in [cell F2]. Explain in plain English how the formula works, and tell me if it needs a newer version of Excel.
Other versions for common jobs
- Look something up: "Write a formula that finds the price for the product code in A2 from my Prices sheet (codes in column A, prices in column C). Show 'Not found' if it's missing."
- Conditions: "Write a formula that shows 'Overdue' if the due date in C2 is before today and the status in D2 isn't 'Paid', otherwise blank."
- Count or total with conditions: "Count how many orders in column B are from the East region and over $1,000 in column D."
- Dates: "Calculate the number of working days between the start date in A2 and end date in B2, skipping weekends."
- Clean-up: "Write a formula that turns names like 'SMITH, john' in column A into 'John Smith'."
Step 3: Fix a formula that's broken
Copy the formula and the error exactly and paste:
This formula returns [#N/A / #VALUE! / #REF! / the wrong number]: [paste formula]. Column [X] contains [what's in it]. What's wrong, and what's the corrected formula?
If you don't understand a formula someone else built, ask: "Explain this formula step by step like I'm new to Excel: [paste formula]."
Step 4: Test it before you copy it down
AI formulas are often right but sometimes quietly wrong, for example counting a header row or using a function your version of Excel doesn't have. Two minutes of checking:
- 1. Try it on 3 to 5 rows where you already know the answer.
- 2. Test an edge case: a blank cell, a missing lookup value, a date at the end of the month.
- 3. If you get #NAME?, tell the AI your Excel version (or that you're on Google Sheets) and ask for an alternative.
More on checking AI output in our free guide, How to Fact-Check an AI Answer in 2 Minutes.
Get 50 more prompts like this
Writing formulas, fixing a broken formula and cleaning messy data are three of the 50 uses in AI Tools for Everyday Work: 50 Practical Uses, alongside the "Spreadsheet rescue" combo. You can test three real prompts from our guide right now, free. When you want more, the full guide gives you 50 ready-to-use prompts, five step-by-step workflows and a seven-day starter plan for $7.
Get 3 free prompts Get the full guide