How to Use ChatGPT for Excel & Google Sheets: Formulas, Macros & Data Cleanup That Save You Hours (2026)

📅 Published March 6, 2026 · ⏱️ 18 min read · 🏷️ Productivity, Business, Data

You've been staring at the same spreadsheet for 20 minutes. You know the formula exists — something with VLOOKUP or INDEX MATCH — but you can't remember the syntax and every Google result shows a different version from 2019.

Meanwhile, your boss needs the report by 3 PM. Your data is a mess. And you just accidentally deleted a column.

Here's the thing nobody in your office has figured out yet: ChatGPT is the best Excel and Google Sheets assistant ever created. Describe what you want in plain English. Get the exact formula. Paste it. Done.

Not "sort of close." Not "here's a tutorial." The actual formula, written for your specific columns, with an explanation of how it works so you actually learn something.

750 Million+ People use Excel worldwide. The average office worker spends 38 hours per year just on spreadsheet tasks. ChatGPT cuts that in half — minimum.

This guide gives you 12 copy-paste prompts that turn ChatGPT into your personal spreadsheet expert. Formulas, data cleanup, macros, pivot tables, dashboards, debugging — everything you actually need, nothing you don't.

Works for Excel, Google Sheets, and LibreOffice Calc. No plugins required. Just ChatGPT and your spreadsheet.

📋 What's Inside

1. Why ChatGPT Beats Googling Formulas

Every spreadsheet user has the same workflow: encounter problem → open Google → type "excel vlookup multiple criteria" → scroll past 4 ads → click a 2,000-word article → scroll past the life story → find a generic example that doesn't match your data → try to adapt it → get a #REF! error → cry.

ChatGPT skips all of that. Here's why it's fundamentally better:

🎯
Your Exact Columns
Tell it your headers (A = Name, B = Sales, C = Region). Get a formula that uses YOUR columns, not generic examples.
🧠
Explains the Why
Not just the formula — WHY each part works. You learn while you solve. No more memorizing syntax you'll forget.
🔄
Iterates With You
"Almost, but I also need to exclude blanks." ChatGPT adjusts instantly. Google search means starting from scratch.
💬
Plain English In
"Sum all sales in column D where the region in column B is 'East' and the month in column C is January." That's it. That's the prompt.
30 Seconds Flat
Complex nested formulas that would take 15 minutes of Googling. Generated in one response. With comments.
🔧
Fixes Your Mistakes
Paste a broken formula. "This gives #VALUE! error." ChatGPT diagnoses the problem and gives you the fix.
💡 The key insight: Google gives you generic answers to generic questions. ChatGPT gives you specific answers to YOUR specific spreadsheet. That's the difference between "VLOOKUP tutorial" and "here's the exact formula for your dataset."

2. How to Talk to ChatGPT About Spreadsheets (The Right Way)

The #1 reason people get bad formulas from ChatGPT: they give bad context. "Write me a VLOOKUP" gets you a generic VLOOKUP. Describe your actual spreadsheet and you get a formula you can paste directly.

The Perfect Spreadsheet Prompt Formula

Every prompt should include three things:

  1. Your column layout — What's in each column (headers + data types)
  2. What you want to happen — The result you need, in plain English
  3. Which platform — Excel or Google Sheets (matters for some functions)
Template

📐 The Master Spreadsheet Prompt

I'm using [Excel / Google Sheets]. My spreadsheet has these columns: - Column A: [what's in it] - Column B: [what's in it] - Column C: [what's in it] (etc.) I need a formula that [describes the result you want]. [Optional: Here's a sample of my data:] [paste 3-5 rows] Please give me: 1. The formula 2. A brief explanation of how it works 3. Any assumptions or things to watch out for

Why this works: ChatGPT can't see your spreadsheet. The more context you give, the more accurate the formula. Pasting sample data is the single biggest accuracy booster.

❌ Bad Prompt

"Write a VLOOKUP formula"

Gets a generic textbook example you'll have to adapt.

✅ Good Prompt

"I have product IDs in A2:A500 and prices in B2:B500. In Sheet2, column D has product IDs. I need to pull the price into Sheet2 column E. Google Sheets."

Gets a formula you can paste directly.

⚠️ Privacy note: Don't paste sensitive data (SSNs, financial records, client info) directly into ChatGPT. Instead, describe the column structure and data types. Use fake sample data if needed. For truly sensitive work, use ChatGPT Enterprise or the API with data retention disabled.

3. Formula Writing: From Simple to Insane

This is where ChatGPT earns its keep. Forget memorizing syntax — just describe what you need.

Lookups (The #1 Use Case)

Lookup

🔍 Prompt #1: VLOOKUP / XLOOKUP / INDEX MATCH

I'm using Excel (Office 365). Sheet1 has: - Column A: Employee ID (text, like "EMP-001") - Column B: Employee Name - Column C: Department - Column D: Annual Salary On Sheet2, I have Employee IDs in column A. I need to pull in their Name, Department, and Salary into columns B, C, and D. Some Employee IDs on Sheet2 might not exist in Sheet1 — show "Not Found" instead of an error. Give me the formula for Sheet2 cell B2, C2, and D2.

Pro tip: If you have Office 365, mention it — ChatGPT will use XLOOKUP instead of VLOOKUP. XLOOKUP is simpler, more powerful, and searches left (VLOOKUP can't). If you're on older Excel, say so and you'll get INDEX MATCH instead.

What you'll get back:

' Sheet2, cell B2 (XLOOKUP version): =XLOOKUP(A2,Sheet1!A:A,Sheet1!B:B,"Not Found") ' Sheet2, cell C2: =XLOOKUP(A2,Sheet1!A:A,Sheet1!C:C,"Not Found") ' Sheet2, cell D2: =XLOOKUP(A2,Sheet1!A:A,Sheet1!D:D,"Not Found")

One prompt. Three formulas. No Googling. No #N/A errors. Done.

Conditional Calculations

Conditional

📊 Prompt #2: Multi-Criteria SUMIFS / COUNTIFS

Google Sheets. My sales data: - Column A: Date (MM/DD/YYYY format) - Column B: Sales Rep Name - Column C: Region (East, West, Central, South) - Column D: Product Category - Column E: Sale Amount ($) I need a formula that: 1. Sums all sales in column E 2. WHERE Region (C) = "East" 3. AND Date (A) is in January 2026 4. AND Product Category (D) = "Software" Put this in cell H2.

Why SUMIFS not SUMIF: ChatGPT knows the difference. SUMIF handles one condition. SUMIFS handles multiple. You don't need to remember which is which — just describe what you need.

ChatGPT will return something like:

=SUMIFS(E:E, C:C, "East", A:A, ">="&DATE(2026,1,1), A:A, "<="&DATE(2026,1,31), D:D, "Software")

Try writing that from memory. I'll wait.

Nested Logic (Where It Gets Fun)

Logic

🧩 Prompt #3: Complex Nested IFs / IFS / SWITCH

Excel. Column F has employee performance scores (0-100). I need a formula in column G that assigns a rating: - 90-100 → "Exceptional" - 80-89 → "Exceeds Expectations" - 70-79 → "Meets Expectations" - 60-69 → "Needs Improvement" - Below 60 → "Performance Plan" - If blank → leave blank Ideally use IFS or SWITCH if cleaner than nested IFs.

ChatGPT's advantage: It knows which function is cleanest for each situation. Nested IFs for 2-3 conditions, IFS for 4+, SWITCH for exact matches. You describe the logic; it picks the best tool.

🚀 Want 100 More Prompts Like These?

Our ChatGPT Prompt Pack includes prompts for business, marketing, content, analysis, and productivity — including advanced spreadsheet prompts.

Get 100 ChatGPT Prompts — $19 →

4. Data Cleanup: Fix Messy Spreadsheets in Minutes

Every spreadsheet professional knows the truth: 80% of the work is cleaning data. 20% is actual analysis. ChatGPT demolishes that 80%.

Here are the data messes it solves instantly:

Cleanup

🧹 Prompt #4: The "Fix My Messy Data" Prompt

Google Sheets. Column A has names in inconsistent formats: - "john smith" - "JANE DOE" - "Bob Johnson" (extra spaces) - " sarah connor " (leading/trailing spaces) - "O'Brien, Conan" (last, first format) I need formulas in Column B that: 1. Fix capitalization to proper case (Title Case) 2. Remove extra spaces 3. Convert "Last, First" to "First Last" 4. Handle all these cases with ONE formula

Real world: This is the kind of data you get from CRM exports, customer forms, and CSV imports. ChatGPT handles the edge cases that simple PROPER() and TRIM() miss.

Cleanup

📅 Prompt #5: Fix Dates That Aren't Really Dates

Excel. Column A has dates in mixed formats — some are actual Excel dates, some are text strings: - 44927 (Excel serial number) - "1/15/2026" (text, not date) - "January 15, 2026" (text) - "2026-01-15" (ISO format text) - "15-Jan-2026" (text) - Some cells are blank I need a formula in Column B that converts ALL of these into proper Excel dates formatted as MM/DD/YYYY. Also, I need it to handle the case where some "dates" might be text-formatted numbers (like "44927").

Why this matters: Mixed date formats are the #1 cause of broken pivot tables and wrong calculations. This prompt handles the nightmare scenario that DATEVALUE() alone can't fix.

Cleanup

🔗 Prompt #6: Split, Merge, and Reshape Data

Google Sheets. I have a column with full addresses in one cell: "123 Main St, Suite 200, Austin, TX 78701" I need to split this into separate columns: - Column B: Street Address ("123 Main St, Suite 200") - Column C: City ("Austin") - Column D: State ("TX") - Column E: Zip Code ("78701") Some addresses have suite numbers, some don't. Some have 5-digit zips, some have ZIP+4 (78701-1234). Give me formulas that handle these variations.

The magic: Address parsing is notoriously hard. ChatGPT handles the edge cases — suites, ZIP+4, missing components — that basic SPLIT() or LEFT()/RIGHT() can't handle alone.

5. VBA Macros & Google Apps Script (Automation)

Here's where ChatGPT goes from useful to career-changing. Writing macros used to require actual programming knowledge. Now you describe what you want and get working code.

Automation

⚡ Prompt #7: VBA Macro — Automate Report Formatting

Write a VBA macro for Excel that does the following: 1. Select all data in the active sheet (from A1 to the last row/column with data) 2. Add filters to the header row 3. Bold and freeze the header row 4. Auto-fit all column widths 5. Add alternating row colors (light gray / white) 6. Format any column that contains dollar amounts as currency ($#,##0.00) 7. Add a thin border around all cells with data 8. Name the macro "FormatReport" Include comments explaining each section so I can modify it later.

How to use it: In Excel, press Alt+F11 to open VBA Editor → Insert → Module → paste the code. Then run it with Alt+F8. ChatGPT writes the ENTIRE macro — you just paste and run.

Automation

📧 Prompt #8: Google Apps Script — Auto-Send Email Reports

Write a Google Apps Script for Google Sheets that: 1. Reads data from a sheet called "Monthly Sales" 2. Columns: A = Sales Rep, B = Region, C = Total Sales, D = Target, E = % of Target 3. Finds all reps where % of Target (column E) is below 80% 4. Creates a nicely formatted HTML email listing the underperforming reps 5. Sends the email to "manager@company.com" 6. Include the data as an HTML table in the email body 7. Subject line: "Sales Alert: [X] Reps Below 80% Target — [Month Year]" 8. Set up a trigger to run this on the 1st of every month Include setup instructions for someone who's never used Apps Script before.

Real power: This kind of automation would cost $500+ from a consultant. ChatGPT writes it in one prompt, with setup instructions. Run it monthly, forever, for free.

💚 VBA vs. Apps Script: VBA is for Excel (desktop). Apps Script is for Google Sheets (web). ChatGPT writes both fluently. Just specify which platform in your prompt. If you're not sure which to use: Google Sheets + Apps Script is easier for beginners and works from any device.

🤖 Ready to Automate Everything?

Our AI Automation Toolkit includes 50+ automation templates and prompts for spreadsheets, email, CRM, and more.

Get the AI Automation Toolkit — $34 →

6. Data Analysis & Pivot Tables

You have data. You need answers. ChatGPT bridges the gap between raw numbers and actual insights — even if you've never built a pivot table in your life.

Analysis

📈 Prompt #9: Instant Data Analysis

I have a Google Sheet with 12 months of sales data (2,000 rows): - Column A: Date - Column B: Product Name (15 different products) - Column C: Category (Electronics, Clothing, Home, Food) - Column D: Units Sold - Column E: Revenue - Column F: Cost - Column G: Profit (Revenue - Cost) I need to understand my business better. Give me: 1. Formulas to calculate total revenue, average order value, and profit margin 2. A formula to find the top 3 products by revenue 3. Month-over-month growth rate formula 4. A way to identify which products are losing money 5. Seasonal trends — which months have highest/lowest sales Also, tell me how to set up a pivot table to slice this data by Category and Month.

Notice: You don't need to know what analysis to run. Describe your data and your question ("understand my business better"). ChatGPT suggests the right analysis AND writes the formulas.

Analysis

📉 Prompt #10: Statistical Analysis for Non-Statisticians

Excel. I'm comparing customer satisfaction scores between two versions of our product: Version A scores (column A, 150 responses): range 1-10 Version B scores (column B, 180 responses): range 1-10 I need to know: 1. Average, median, and standard deviation for each version 2. Is the difference between them statistically significant? (I don't know statistics — explain what test to use and why) 3. The formulas to run the test in Excel 4. How to interpret the result in plain English Keep the explanation simple — I'm not a data scientist.

Why this is huge: ChatGPT democratizes statistics. You don't need a stats degree to know if your data is meaningful. It picks the right test (t-test here), writes the formula, and explains the p-value like a human.

7. Build Dashboards & Reports

A good dashboard turns "here's a spreadsheet" into "here's the answer." ChatGPT helps you build them without knowing anything about data visualization theory.

Dashboard

🎛️ Prompt #11: Build a KPI Dashboard

I need to create a dashboard sheet in Google Sheets that pulls data from my "Raw Data" sheet. Raw Data columns: - A: Date, B: Sales Rep, C: Product, D: Revenue, E: Units, F: Region On my Dashboard sheet, I want: 1. Total Revenue (this month vs. last month, with % change) 2. Total Units Sold (same comparison) 3. Top 5 Sales Reps by Revenue (a mini leaderboard) 4. Revenue by Region breakdown 5. Daily revenue trend for the current month 6. Average deal size Give me: - The formulas for each metric - Which chart type to use for each visualization - How to make the dashboard auto-update when new data is added - Conditional formatting rules (green if up, red if down) Make it look professional without any add-ons or plugins.

The trick: Ask ChatGPT for conditional formatting rules alongside the formulas. A dashboard with color-coded KPIs (green = good, red = bad) looks 10x more professional and takes zero extra effort.

8. Debug Broken Formulas (The Secret Killer Feature)

This is the use case that saves the most time. You have a formula. It's broken. You've been staring at it for 20 minutes. Just paste it into ChatGPT.

Debug

🔍 Prompt #12: Fix This Broken Formula

This formula gives me a #VALUE! error and I can't figure out why: =INDEX(Sheet2!B:B,MATCH(1,(Sheet2!A:A=A2)*(Sheet2!C:C="Active"),0)) Context: - Sheet2 Column A has customer IDs (text format like "CUST-001") - Sheet2 Column B has customer names - Sheet2 Column C has status ("Active" or "Inactive") - Cell A2 on my current sheet has a customer ID - I'm trying to find the name of an active customer I'm using Google Sheets. What's wrong, and what's the fix?

Fastest debugging ever: Paste broken formula + the error message + what you expected. ChatGPT explains the bug (this one needs ARRAYFORMULA or Ctrl+Shift+Enter in Excel), gives the fix, AND suggests a simpler alternative approach.

Common errors ChatGPT fixes instantly:

💡 Power move: When ChatGPT fixes your formula, ask "Can you explain why this happened so I avoid it next time?" You'll build real spreadsheet skills without ever reading a textbook.

9. ChatGPT vs. Microsoft Copilot vs. Google Duet AI

Three AI tools. Three very different approaches. Here's when to use which:

Feature ChatGPT (Free/Plus) Copilot in Excel ($30/mo) Gemini in Sheets (Workspace)
Works inside spreadsheet No (separate tab/app) Yes (sidebar) Yes (sidebar)
Sees your actual data Only if you paste it Yes (full file access) Yes (full file access)
Formula writing ⭐⭐⭐⭐⭐ (best explanations) ⭐⭐⭐⭐ (good, less detail) ⭐⭐⭐ (decent, improving)
VBA/Apps Script ⭐⭐⭐⭐⭐ (full programs) ⭐⭐⭐ (basic macros) ⭐⭐⭐ (basic scripts)
Data analysis ⭐⭐⭐⭐ (conversational) ⭐⭐⭐⭐⭐ (sees real data) ⭐⭐⭐⭐ (improving fast)
Chart creation Instructions only Creates actual charts Creates actual charts
Price Free / $20/mo $30/user/month $20/user/month (Workspace)
Best for Learning, complex formulas, macros, debugging In-app manipulation, quick analysis Simple tasks, Google Workspace users
💚 The smart approach: Use ChatGPT for complex formulas, debugging, and macro writing (it's the best at explaining and generating code). Use Copilot/Gemini for quick in-app tasks when you need to manipulate data you're already looking at. Most power users run both.

10. 7 Mistakes That Get You Wrong Formulas From ChatGPT

ChatGPT is brilliant at spreadsheets, but garbage in = garbage out. Avoid these and your formulas will work on the first try, almost every time:

  1. Not specifying Excel vs. Google Sheets. Some functions exist in one but not the other (XLOOKUP, IMPORTRANGE, UNIQUE behavior). Always say which platform.
  2. Saying "my data" without describing columns. "Look up a value in my data" could mean anything. "Look up the price in column D using the product ID in column A" gets an exact formula.
  3. Forgetting to mention data types. Is your "date" column actually formatted as dates, or text strings that look like dates? Is your "number" column actually numbers, or numbers stored as text? This is the #1 cause of formulas that return errors.
  4. Not mentioning edge cases. Blank cells, N/A values, duplicates, mixed formats — if your data has them (it does), mention them. "Some cells are blank" changes the formula ChatGPT writes.
  5. Asking for a specific function instead of the result. ❌ "Write me a VLOOKUP." ✅ "I need to find the price of a product based on its name." Let ChatGPT pick the best function — it might use XLOOKUP, INDEX MATCH, or FILTER instead, which could be better.
  6. Not testing on a small sample first. Always test the formula on 5-10 rows before applying it to 10,000 rows. ChatGPT is very accurate but not 100% — edge cases in YOUR data might need adjustments.
  7. Using the formula without understanding it. ChatGPT explains every formula. Read the explanation. You'll learn faster, catch errors quicker, and become the spreadsheet person in your office instead of the person who "uses AI" as a crutch.

📦 Get Everything — Save 60%

100 ChatGPT Prompts + AI Automation Toolkit + Freelancer's AI Toolkit + SEO Blog Prompts + Marketing Prompts + Content Creator's Second Brain. One price, all access, forever.

Get the All Access Bundle — $69 →

Frequently Asked Questions

Can ChatGPT write Excel formulas?

Yes. ChatGPT writes virtually any Excel formula — VLOOKUP, INDEX MATCH, SUMIFS, COUNTIFS, nested IFs, array formulas, XLOOKUP, and complex conditional logic. Describe your column layout and what result you need. It generates the formula with an explanation. It handles both basic and advanced calculations across Excel and Google Sheets.

Does ChatGPT work with Google Sheets or just Excel?

Both. Most formulas are identical between platforms. When there are differences (XLOOKUP availability, Apps Script vs VBA, Google-specific functions like IMPORTRANGE and GOOGLEFINANCE), ChatGPT knows the distinctions and writes platform-specific formulas when you tell it which one you're using.

Can I paste my actual spreadsheet data into ChatGPT?

Yes — copy a range from your spreadsheet and paste it directly into the chat. ChatGPT reads the columns and rows. Just be cautious with sensitive data (financial records, personal info, client data). For sensitive spreadsheets, describe the structure without pasting actual values, or use fake sample data.

Can ChatGPT write VBA macros for Excel?

Absolutely. It writes VBA macros, Google Apps Script, and Office Scripts. Describe what you want automated — formatting reports, sending emails, consolidating sheets, generating charts — and it writes complete code with comments. It also debugs existing macros when you paste your code with the error description.

Is ChatGPT better than Copilot in Excel?

Different tools for different jobs. Copilot works inside your spreadsheet and sees your actual data — great for quick manipulation. ChatGPT is better for complex formulas, detailed explanations, macro writing, debugging, and learning. Many power users use both. ChatGPT is also free, while Copilot requires Microsoft 365 Copilot ($30/month).

How accurate are ChatGPT's formulas?

Very high accuracy for standard operations. VLOOKUP, SUMIFS, INDEX MATCH, and common calculations are almost always correct on the first try. Complex nested formulas and unusual edge cases may need tweaking. Always test on a small data sample first. The key to accuracy: give clear context including column names, data types, and sample data.

← Back to Blog Learn Languages with ChatGPT →

📌 Want More Prompts?

Get our complete collection of 200 free ChatGPT prompts covering business, marketing, coding, writing, productivity, and more — all copy-paste ready.

→ Browse All 200 Free Prompts