How to Use AI in Excel and Google Sheets: Formulas, Cleanup and Analysis
You have a formula that will not work, a column full of messy data, or a sheet of numbers that you do not know how to summarize. A few years ago, that meant searching forums for an hour. Today, an AI chatbot can often get you most of the way there in a minute.
In this guide you will learn how to use AI in Excel and Google Sheets for three jobs: writing formulas, cleaning messy data and analyzing results. You will get copy-paste prompts, example formulas and a simple checklist to make sure the answers are right. For more ways to save time at work, see our list of the best AI productivity tools.
- What AI can and can’t do in a spreadsheet
- Before you start: protect your data
- How to describe your spreadsheet to AI
- Use AI to write formulas
- Use AI to explain and fix formulas
- Use AI to clean messy data
- Use AI to analyze your data
- Built-in AI features vs. a chatbot
- A simple workflow you can follow
- Mistakes to avoid
- FAQ
What AI Can (and Can’t) Do in a Spreadsheet
AI is good at:
- Writing a formula from a plain-English description
- Explaining what a long formula does
- Finding the likely cause of a formula error
- Suggesting steps to clean and standardize data
- Suggesting charts, pivot table layouts and ways to summarize results
AI is not good at:
- Being right every time. It can write a formula that looks correct but returns the wrong result, or one that does not exist in your version of the app. This is a kind of hallucination.
- Doing reliable arithmetic on pasted numbers. Let the spreadsheet do the math. Use AI to write the formula, not to calculate the total.
- Seeing your file. A chatbot only knows what you tell it or share with it.
For more on spotting and fixing AI mistakes, read our guide to detecting and fixing AI hallucinations.
Before You Start: Protect Your Data
You rarely need your whole file. To get a formula, the AI only needs to know what your columns look like. Three or four fake rows are enough.
How to Describe Your Spreadsheet to AI (the 4-Part Context Rule)
Most bad formulas come from missing context. Tell the AI these four things:
- The app: Excel (and which version) or Google Sheets.
- The columns: what each column contains.
- The range: exact cells, for example A2:E100.
- The result you want: what should appear and in which cell.
Here is a fill-in prompt you can reuse:
This follows the same pattern we use in our AI prompt templates: give a role, a task, context and a format.
Use AI to Write Formulas
The method is simple: describe the goal in plain English, paste the formula into one cell, then test it on a few rows where you already know the answer. The examples below use a sales sheet with these columns: A Date, B Region, C Product, D Units, E Revenue.
1. Add up values that meet a condition
A formula you might get back:
2. Look up a value from another table
If your version does not support XLOOKUP, ask for a VLOOKUP version instead. It looks like =IFERROR(VLOOKUP(C2,Prices!A:B,2,FALSE),"Not found").
3. Calculate a percentage change
Then format the cell as a percentage.
4. Combine text from two columns
5. Count items that meet two conditions
6. Show a label based on a value
Use AI to Explain and Fix Formulas
7. Explain a formula you did not write
Formula: [paste formula]
Best for: inheriting a sheet from a coworker, or understanding a formula the AI wrote before you use it.
8. Find and fix an error
Formula: [paste formula]
What the cells contain: [describe a few sample values]
These are the errors you will see most often:
| Error | What it usually means |
|---|---|
| #N/A | A lookup could not find the value you searched for |
| #REF! | The formula points to a cell or range that was deleted or is no longer valid |
| #VALUE! | The wrong type of data, such as text where a number is expected |
| #DIV/0! | Dividing by zero or by an empty cell |
| #NAME? | A misspelled function name, or a function your app or version does not support |
Use AI to Clean Messy Data
Messy data is the most common reason spreadsheets break. Here is a small example of what you might start with:
| Name | Date | Amount |
|---|---|---|
| john SMITH | 3/5/2026 | $1,200 |
| Mary Jones | 2026-03-07 | 950 |
| john smith | March 9, 2026 | 1200 |
You can see extra spaces, mixed capitalization, three different date formats, amounts with and without symbols, and what looks like a duplicate person. After cleanup you want this:
| Name | Date | Amount |
|---|---|---|
| John Smith | 2026-03-05 | 1200 |
| Mary Jones | 2026-03-07 | 950 |
| John Smith | 2026-03-09 | 1200 |
Note that the two John Smith rows are different dates, so they may be two real sales and not a duplicate. Always decide what counts as a duplicate before you delete anything.
9. Remove extra spaces
10. Standardize capitalization
Check unusual names afterwards. This kind of formula can change names such as “McDonald” to “Mcdonald.”
11. Split a full name into two columns
In Google Sheets you can use =SPLIT(A2," "). In newer versions of Excel, =TEXTSPLIT(A2," ") does the same job. In older Excel, the Text to Columns tool on the Data tab works well.
12. Make dates consistent
This one needs extra care. A date like 3/5/2026 can mean March 5 or 3 May, depending on your region. Ask the AI to flag ambiguous dates, and check a few by hand.
13. Find and remove duplicates
Both apps have a built-in tool for this. In Excel it is Data > Remove Duplicates. In Google Sheets it is Data > Data cleanup > Remove duplicates. To only list unique values, you can use =UNIQUE(A2:A100) in Google Sheets and in newer versions of Excel.
14. Sort text into categories
Keyword rules are simple and not perfect, so review the results. If you want a deeper look at customer feedback, read how to use AI to analyze customer reviews and feedback.
Use AI to Analyze Your Data
Once your data is clean, AI can help you decide what to look at. A good approach is to paste a small sample or a summary table (never confidential data), explain what the columns mean, and ask for ideas. Then build the real numbers with formulas or a pivot table, so the spreadsheet does the calculating.
15. Find the main trends
Data: [paste a small summary table]
16. Suggest the right chart
17. Plan a pivot table
18. Spot outliers and errors
19. Write a short summary for your manager
Figures: [paste the verified numbers from your sheet]
Only paste numbers you have already checked. For a longer write-up, see how to create a professional business report with AI.
Built-in AI Features vs. Using a Chatbot
Excel and Google Sheets both offer built-in AI assistants in some plans, and you can also use a separate chatbot. Each has strengths:
| Built-in AI in the app | Separate AI chatbot | |
|---|---|---|
| Convenience | Works inside your file, so less copying and pasting | You copy prompts and formulas back and forth |
| Availability | Depends on your plan, account type and region, and changes often | Many have a free tier |
| Flexibility | Focused on that one app | Works with any spreadsheet app and other tasks |
| Data handling | Check your organization’s and the provider’s privacy terms | Check privacy settings and avoid sensitive data |
Features and plans change often, so check each product’s current help page before you decide. If you are choosing a chatbot, see our top 10 AI chatbots and our ChatGPT vs Claude vs Gemini comparison.
A Simple Workflow You Can Follow
- Back up. Duplicate your sheet or tab before you change anything.
- Describe your data. Use the 4-part context rule: app, columns, range, result.
- Ask for one thing at a time. A formula, a cleanup step or a chart, not all three at once.
- Test small. Try the formula on three to five rows where you already know the answer.
- Check the totals. For example, the sum of your region totals should equal the grand total. Then apply it to the full sheet.
Worked example: you have 500 rows of sales data and want revenue by region. Ask the AI for a SUMIFS formula (prompt 1), test it on one region you can add up by hand, copy it for the other regions, and check that the four region totals add up to the sum of the whole revenue column. If they match, you are done. If they do not, ask the AI to find the problem and paste the formula and a few sample rows.
To connect steps like this into a repeatable routine, read how to build an AI workflow.
Mistakes to Avoid
- Pasting private data. Use samples and placeholders.
- Not saying which app you use. Formulas and menu steps differ between Excel and Google Sheets.
- Applying a formula to the whole sheet without testing. Check a few rows first.
- Trusting the first answer. Treat AI output as a draft. See our guide to fact-checking AI-generated content for the same habit applied to writing.
- Skipping the backup. Cleanup steps can overwrite data.
Frequently Asked Questions
Can AI write Excel formulas for me?
Yes. Describe what you want and which app you use, and the AI can suggest a formula. Test it on a few rows before using it on all your data.
Can a chatbot analyze an Excel file?
Some chatbots let you upload spreadsheets, but this depends on the tool, your plan and file limits. Even then, check the results yourself, and do not upload confidential files.
Is it safe to upload spreadsheets to an AI tool?
It depends on the tool and on what the file contains. Avoid sensitive or confidential data, read the tool’s privacy policy, and follow your workplace rules.
Do I need to know formulas to use AI in Excel?
No, but it helps to understand the basics so you can test whether the answer is right. Asking the AI to explain each formula (prompt 7) is a good way to learn as you go.
Final Thoughts
AI will not replace your spreadsheet skills, but it can remove a lot of the frustration. Describe your data clearly, ask for one thing at a time, test on a small sample and check the totals. For more ideas, browse our list of the best AI productivity tools, and practice your prompt writing with our 20 copy-paste AI prompt templates.
.webp)
0 Comments