Tutorials

How to Use AI in Excel and Google Sheets: Copilot, Gemini and AI Formula Help

How to use AI in Excel and Google Sheets with Copilot, Gemini and chat assistants, plus worked formula examples and the data privacy checks to run first.

S
Sarah Mitchell
13 min read

The Short Answer

There are three practical ways to use AI in a spreadsheet today:

  1. Built-in assistants. Copilot in Excel and Gemini in Google Sheets sit in a side panel. You describe what you want in plain English and they write formulas, build charts and PivotTables, clean data or edit the sheet.
  2. AI inside cells. Google Sheets has an AI function (=AI() or =Gemini()) that runs a prompt on each row, for jobs like categorizing feedback or summarizing notes.
  3. A chat assistant as a formula tutor. ChatGPT, Claude or Gemini can write and explain formulas from a plain description, either in a normal chat or through official add-ins for Excel and Sheets.

Whichever route you choose, two rules hold: test every formula on rows where you already know the answer, and check what data you are allowed to share before pasting anything into an AI tool.


Option 1: Microsoft Copilot in Excel

Who has it

According to Microsoft's Copilot in Excel FAQ, you can use Copilot in Excel with any of the following:

  • A Microsoft 365 Personal or Family subscription with an AI credits plan
  • A Microsoft 365 Premium subscription
  • A commercial Microsoft Copilot subscription
  • A Copilot Chat-eligible Microsoft 365 or Office 365 business or enterprise subscription

Inside Excel, business users may see a Premium label (they have the Copilot add-on license, with priority access) or Basic (standard access without the add-on). For Family subscriptions, Microsoft's January 2025 announcement noted that Copilot is available to the subscription owner and cannot be shared with other members.

What it can do

Microsoft's FAQ says Copilot can get insights, generate formulas, create charts and PivotTables, apply formatting, edit worksheets, generate and transform data, highlight, sort and filter data, fetch information from the web, and search your work files for context. It offers three modes:

ModeWhat it is forWhere it is available (per Microsoft's FAQ)
ChatAsking questions about your data, getting explanationsWindows, Mac, web, iPad, iPhone, Android
PlanWorking out an approach before making changesWindows, Mac, web, iPad
EditLetting Copilot change the workbook directlyWindows, Mac, web (rolling out to iPad and iPhone)

Requirements worth knowing

  • Copilot editing only works when Calculation Options are set to Automatic.
  • Older formats such as Strict Open XML Spreadsheet are not supported. Save as a normal .xlsx workbook.
  • Files checked out in SharePoint can trigger an "Unsupported file state" error.

The COPILOT function was retired

Microsoft previewed a =COPILOT() worksheet function for Insider and Frontier program users. Microsoft's COPILOT function page now says that starting September 14, 2026, the function is no longer available. Previously calculated results stay as cached values, but a cell that recalculates shows a #NAME? error. If you have workbooks that used it, replace those cells with values or regular formulas, and use the Copilot pane for that kind of task instead.

Good prompts for Copilot in Excel

  • "Add a column that shows the number of days between Order Date and Ship Date."
  • "Create a PivotTable of total revenue by region and month."
  • "Highlight rows where Status is Overdue and Amount is over 1,000."
  • "Explain what the formula in F2 does, step by step."
  • "Which three products had the biggest drop in sales from Q2 to Q3?"

Format your data as an Excel table (select it and press Ctrl+T) with clear, single-row headers. AI assistants work much better on tidy, well-labelled tables than on sheets with merged cells and blank rows.


Option 2: Gemini in Google Sheets

The Gemini side panel

Google's help page on Gemini in Sheets says Gemini can create tables and formulas, generate analysis and insights, build charts, and summarize emails and files from Drive and Gmail. It can also take actions such as conditional formatting, pivot tables and filters. A separate page on building or editing entire spreadsheets with Gemini notes that these features work best with native Google Sheets files, so convert an uploaded Excel file with File, then Save as Google Sheets.

The AI function

Google's AI function guide describes a cell formula that sends a prompt to Gemini, optionally with a range of cells as input:

=AI("prompt", [optional range])

You can type =Gemini() instead of =AI(). Google's own examples include:

=AI("Classify the body of the email, as either positive, negative, or neutral.", D2)
=AI("For the customer, write a one sentence summary of their feedback.", A2:D2)

After entering the function, you select the cells and click Generate and Insert. Key limitations from Google's page:

  • Output is text only, and the function cannot be nested inside other functions.
  • It cannot see your whole spreadsheet or your Drive files, only the range you pass it.
  • If you select many AI cells, only the first 350 are generated at a time.
  • There are short-term and long-term usage limits.
  • It requires an eligible Google Workspace or Google AI plan (or enrolment in Google's Workspace Experiments program).

Google also warns that Gemini "may suggest inaccurate or inappropriate information." For categorization jobs, spot-check a sample of rows by hand before you trust the whole column.

Fill columns with Gemini

The same help page describes a quicker option for tables: if a column already has at least one filled cell, Gemini can fill the rest based on the table's context, or you can add an AI column and write a prompt for it.


Option 3: Use ChatGPT, Claude or Gemini to Write Formulas

You do not need a built-in assistant to get AI help with formulas. Describe your sheet and your goal to any chat assistant and ask for the formula plus an explanation. There are also official add-ins:

  • ChatGPT for Excel and Google Sheets: OpenAI's help article describes a sidebar that can build, update and explain spreadsheets, available on Free and Go (with limited usage) and on paid plans.
  • Claude for Excel: Anthropic's help article describes an add-in for Pro, Max, Team and Enterprise plans that can answer questions about a workbook, debug errors and build or update models.

How to ask for a formula

The quality of the formula depends on how well you describe the sheet. Include:

  1. Which app (Excel 365, older Excel, or Google Sheets). Some functions exist in one and not the other.
  2. Where the data is (sheet name, columns, header row, how many rows).
  3. What the result should be, ideally with one worked example.
  4. Edge cases (blanks, text in number columns, missing matches).

Weak prompt:

Give me a formula to look up prices.

Strong prompt:

I'm using Excel 365. On the sheet "Orders", column A has product codes
(from A2 down). On the sheet "Products", A2:A200 has product codes and
C2:C200 has unit prices. In Orders!B2 I want the unit price for the code
in A2. If the code isn't found, show "Not found". Explain the formula.

If prompting is new to you, our prompt engineering guide for beginners explains why context, examples and a clear output format make such a difference.


Worked Formula Examples

These are the kinds of formulas people most often ask AI for. Each one is standard syntax that you can check against the official function reference. Unless noted, they work in Excel 365 and Google Sheets.

1. Look up a value from another sheet

=XLOOKUP(A2, Products!A$2:A$200, Products!C$2:C$200, "Not found")

Finds the code in A2 within the product list and returns the matching price from column C. The fourth argument is what to show when there is no match. The $ signs lock the ranges so the formula can be filled down. XLOOKUP is available in Excel 365, Excel 2021 and later, and Google Sheets. In older Excel, use:

=IFERROR(VLOOKUP(A2, Products!$A$2:$C$200, 3, FALSE), "Not found")

2. Sum with several conditions

Total sales in column D where the region in column B is "West" and the date in column C is in 2026:

=SUMIFS(D2:D500, B2:B500, "West", C2:C500, ">="&DATE(2026,1,1), C2:C500, "<="&DATE(2026,12,31))

The first range is what gets added up; each pair after it is a range and a condition. Comparison operators go inside quotes and are joined to the date with &.

3. Count with conditions

How many orders from "West" are over 1,000:

=COUNTIFS(B2:B500, "West", D2:D500, ">1000")

4. Percentage change without errors

Change from last month (B2) to this month (C2), returning a blank if last month was zero or empty:

=IF(N(B2)=0, "", (C2-B2)/B2)

Format the column as a percentage. N(B2) turns a blank cell into 0, so the check covers both blanks and zeros and you never get a #DIV/0! error.

5. Days overdue

Days past the due date in C2, never negative:

=MAX(0, TODAY()-C2)

6. Split a full name

First name and last name from "Ana Lopez" in A2 (Excel 365):

=TEXTBEFORE(A2, " ")
=TEXTAFTER(A2, " ", -1)

The -1 tells TEXTAFTER to use the last space, so "Ana Maria Lopez" still returns "Lopez". Google Sheets does not have TEXTBEFORE or TEXTAFTER, so use these instead:

=INDEX(SPLIT(A2, " "), 1)
=REGEXEXTRACT(A2, "\S+$")

The first takes the first piece of the split name; the second uses a regular expression to grab the last run of non-space characters.

7. Filter rows that meet a condition

All rows from A2:D500 where the amount in column D is over 1,000:

=FILTER(A2:D500, D2:D500>1000)

This spills the matching rows into the cells below and to the right, so leave that area empty. It works in Excel 365 and Google Sheets.

8. A unique list

Every distinct region in column B, without duplicates:

=UNIQUE(B2:B500)

Wrap it in SORT for an alphabetical list: =SORT(UNIQUE(B2:B500)). If the range includes empty cells, the result can include an extra entry for the blanks (Excel shows it as 0); filter it out with =SORT(UNIQUE(FILTER(B2:B500, B2:B500<>""))).

9. Summary by group in Google Sheets

Google Sheets' QUERY function uses a SQL-like language. Total of column D for each region in column B, with one header row:

=QUERY(A1:D500, "select B, sum(D) where D is not null group by B", 1)

Quick reference

TaskFunction to ask forExcel 365Google Sheets
Look up a valueXLOOKUPYesYes
Sum or count with conditionsSUMIFS, COUNTIFSYesYes
Return matching rowsFILTERYesYes
Remove duplicatesUNIQUEYesYes
Split text by a delimiterTEXTBEFORE, TEXTAFTERYesUse SPLIT or REGEXEXTRACT
SQL-style summariesQUERYNo (use a PivotTable)Yes

How to Check an AI-Written Formula

AI assistants are usually right on standard formulas and occasionally wrong in ways that are easy to miss. Before you rely on one:

  1. Test it on rows where you know the answer. Calculate two or three by hand.
  2. Try the edge cases. A blank cell, a zero, text in a number column, a code that does not exist.
  3. Check the ranges. A range that stops at row 200 will silently ignore row 201. Excel tables and whole-column references avoid this.
  4. Ask for an explanation. "Explain each part of this formula" often reveals a misunderstanding of your data.
  5. Read the absolute references. Missing $ signs cause ranges to shift when you fill a formula down.

Data Privacy: What to Check Before You Paste

Spreadsheets often hold the most sensitive data a business has: customer lists, salaries, prices and health or financial records. Before using any AI tool with them:

  • Follow your organization's policy. If your employer provides Copilot or Gemini through a work account, use that rather than a personal account.
  • Know how work and personal accounts differ. Google's Workspace generative AI privacy hub says that with a qualifying Workspace edition, Gemini does not use your prompts or content to train models without permission. Those commitments apply to qualifying work and education accounts, not to every personal account, so read the terms for the account you are actually using.
  • Check consumer chat settings. Consumer chat assistants generally let you control whether your conversations are used to improve their models. OpenAI explains its options in its data controls FAQ.
  • Share structure, not data. To get a formula, you rarely need real rows. Describe the columns, or paste five rows of made-up sample data with the same format.
  • Remove identifiers. Strip names, emails, account numbers and anything regulated before sharing a sample.

For more on choosing AI tools for a team, see our guide to the best AI tools for business. If you want spreadsheets to update themselves when new data arrives, AI automation tools for small business covers that next step.


FAQ

Can I use AI in Excel for free?

Copilot in Excel requires an eligible Microsoft 365 plan, according to Microsoft's FAQ. A free option is to describe your problem to a free tier of a chat assistant and paste the formula it gives you into Excel. OpenAI's help center also says its ChatGPT for Excel add-in offers limited usage on the Free plan.

What happened to the COPILOT function in Excel?

Microsoft's support page says the preview =COPILOT() function stopped being available on September 14, 2026. Existing results remain as cached values, but recalculating cells show #NAME?. Microsoft recommends using the Copilot pane for the same kinds of tasks.

How do I use the AI function in Google Sheets?

Type =AI("your prompt", range) in a cell, for example to classify or summarize the text in the referenced cells, then select the cells and click Generate and Insert. It needs an eligible Google Workspace or Google AI plan, and outputs text only.

Is it safe to upload company spreadsheets to ChatGPT?

Only if your organization allows it and the account you use has appropriate data protections. The safer habit is to describe the structure of your sheet or share a small anonymized sample rather than the real file.

Are AI-generated Excel formulas reliable?

For common functions such as XLOOKUP, SUMIFS and FILTER they are usually correct, but mistakes in ranges, conditions and edge cases do happen. Always test a formula on rows where you already know the right answer.

Tagshow to use AI in ExcelCopilot in ExcelGemini in Google SheetsAI Excel formulasChatGPT for ExcelAI spreadsheet tools

Want More AI Insights?

Join 10,000+ professionals getting weekly AI news, tool reviews, and tutorials.

Explore More Articles