How to Use AI in Excel and Google Sheets: Formulas & Cleanup

How to use AI in Excel and Google Sheets: formulas, cleanup and analysis

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

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

Do not paste confidential data into an AI chatbot. That includes customer details, employee information, financial records, passwords and anything your employer treats as private. Use a few sample rows, rename the columns, or replace real names and numbers with placeholders. Check your workplace rules and the tool’s privacy settings first.

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:

  1. The app: Excel (and which version) or Google Sheets.
  2. The columns: what each column contains.
  3. The range: exact cells, for example A2:E100.
  4. The result you want: what should appear and in which cell.

Here is a fill-in prompt you can reuse:

I use [Excel / Google Sheets]. My data is in A2:[E100]. Column A is [what], column B is [what], column C is [what]. I want [describe the result] in cell [cell]. Write the formula, explain it in one sentence, and tell me if it needs a specific version of the app.

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

I use [Excel / Google Sheets]. Column B is region and column E is revenue, from row 2 to row 100. Write a formula that adds the revenue for the region “North”.

A formula you might get back:

=SUMIFS(E2:E100,B2:B100,"North")

2. Look up a value from another table

I use [Excel / Google Sheets]. Column C has product names. On a sheet called Prices, column A has product names and column B has prices. Write a formula for cell F2 that finds the price for the product in C2 and shows “Not found” if it is missing.
=XLOOKUP(C2,Prices!A:A,Prices!B:B,"Not found")

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

I use [Excel / Google Sheets]. Last month’s revenue is in B2 and this month’s is in C2. Write a formula for D2 that gives the percentage change and leaves the cell blank if B2 is zero.
=IF(B2=0,"",(C2-B2)/B2)

Then format the cell as a percentage.

4. Combine text from two columns

I use [Excel / Google Sheets]. First names are in column A and last names are in column B. Write a formula for C2 that shows the full name with one space between them.
=A2&" "&B2

5. Count items that meet two conditions

I use [Excel / Google Sheets]. Column B is region and column D is units sold, rows 2 to 100. Write a formula that counts how many rows are in the North region and have more than 100 units.
=COUNTIFS(B2:B100,"North",D2:D100,">100")

6. Show a label based on a value

I use [Excel / Google Sheets]. Revenue is in E2. Write a formula for F2 that shows “High” if revenue is 1000 or more, “Medium” if it is 500 or more, and “Low” otherwise.
=IF(E2>=1000,"High",IF(E2>=500,"Medium","Low"))
Tip: Function support can differ between Excel and Google Sheets, and between versions of Excel. Always tell the AI which app you use, and if you see a #NAME? error, ask for a version that works in your app.

Use AI to Explain and Fix Formulas

7. Explain a formula you did not write

Explain this [Excel / Google Sheets] formula step by step in plain English, as if I am a beginner. Then tell me what each part does and give one example input and output.

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

I use [Excel / Google Sheets]. This formula gives the error [error message]. Find the most likely cause and give a corrected formula. If you need more information, ask me one question.

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/AA 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  Jones2026-03-07950
john smithMarch 9, 20261200

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 Smith2026-03-051200
Mary Jones2026-03-07950
John Smith2026-03-091200

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.

Tip: Always clean a copy of your sheet, never the original. Make a copy of the tab before you start.

9. Remove extra spaces

I use [Excel / Google Sheets]. Column A has names with extra spaces at the start, end and between words. Write a formula for B2 that removes them.
=TRIM(A2)

10. Standardize capitalization

I use [Excel / Google Sheets]. Column A has names in mixed capitalization. Write a formula for B2 that trims extra spaces and makes each name start with capital letters.
=PROPER(TRIM(A2))

Check unusual names afterwards. This kind of formula can change names such as “McDonald” to “Mcdonald.”

11. Split a full name into two columns

I use [Excel / Google Sheets]. Column A has full names like “John Smith”. Show me how to split them into first name and last name in separate columns. Give me the option for my app and one that works in older versions.

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

I use [Excel / Google Sheets]. Column B has dates in different formats, and some are stored as text. Give me a way to convert them all to YYYY-MM-DD. Tell me which formats could be ambiguous, such as 3/5/2026.

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

I use [Excel / Google Sheets]. My data is in A1:E100 with headers in row 1. Show me how to find duplicate rows based on [columns], and how to remove them safely without losing the original data.

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

I use [Excel / Google Sheets]. Column A has customer comments. Write a formula for B2 that labels each comment as “Shipping”, “Price”, “Quality” or “Other” based on keywords in the text.
=IF(ISNUMBER(SEARCH("ship",A2)),"Shipping",IF(ISNUMBER(SEARCH("price",A2)),"Price",IF(ISNUMBER(SEARCH("quality",A2)),"Quality","Other")))

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

Act as a data analyst. Below is a summary of my monthly sales by region. List the 3 most important trends, 2 things that look unusual, and 3 questions I should check in the full data. Do not invent numbers that are not in the table.

Data: [paste a small summary table]

16. Suggest the right chart

I use [Excel / Google Sheets]. My columns are: [list columns]. I want to show [what you want to show] to [audience]. Which chart type should I use, which columns go on each axis, and how do I create it step by step?

17. Plan a pivot table

I use [Excel / Google Sheets]. My columns are: [list columns]. I want to know [your question, such as total revenue by region and month]. Tell me what to put in Rows, Columns, Values and Filters, and which summary (sum, count, average) to use.

18. Spot outliers and errors

I use [Excel / Google Sheets]. Column E has revenue figures. Show me how to highlight values that are much higher or lower than usual, and how to check whether they are mistakes. Give the steps for conditional formatting and a simple formula.

19. Write a short summary for your manager

Act as a business writer. Using only the figures below, write a 5-sentence summary for my manager: what happened, what changed, and one recommended next step. Use a clear, professional tone.

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.

Key takeaway: Use AI to decide what to calculate and to write the formula. Let the spreadsheet do the actual calculating, and check the totals yourself.

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
ConvenienceWorks inside your file, so less copying and pastingYou copy prompts and formulas back and forth
AvailabilityDepends on your plan, account type and region, and changes oftenMany have a free tier
FlexibilityFocused on that one appWorks with any spreadsheet app and other tasks
Data handlingCheck your organization’s and the provider’s privacy termsCheck 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

  1. Back up. Duplicate your sheet or tab before you change anything.
  2. Describe your data. Use the 4-part context rule: app, columns, range, result.
  3. Ask for one thing at a time. A formula, a cleanup step or a chart, not all three at once.
  4. Test small. Try the formula on three to five rows where you already know the answer.
  5. 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.

Post a Comment

0 Comments