Formulas and the COPILOT Function

Let Copilot write the formula, classify the text, and run the multi-step edit, while you keep every result auditable with named denominators, known-value tests, and workbook invariants.


What you'll learn

  • Choose between an ordinary formula, the COPILOT function, and suggestions
  • Write formula prompts that name the metric, denominator, and edge cases
  • Verify a generated formula against known-value tests
  • Bound a multi-step Edit with Copilot request with invariants
On this page

You know the business rule: gross margin is profit divided by revenue. The part you've forgotten is the syntax, whether it needs IFERROR or IF, or what the formula should do with a blank or zero. Copilot can write the formula from a sentence. It can also classify customer comments and carry out a checklist of workbook edits. Your job is to leave a clear trail from the request to a result you can test.

Three ways Copilot touches a formula

Copilot can enter formula work in three different ways. Identify which one you're using before you accept the result:

Pattern What it does Reach for it when
Formula generation You describe a calculation, Copilot proposes an Excel formula You know the business rule but not the syntax
The COPILOT function =COPILOT(instruction, context) returns generated content in a cell The task is language: classify, summarize, extract, rewrite
Automatic suggestions Excel offers a formula as you build a pattern You want Excel to continue an obvious column for you

Deterministic work belongs in ordinary Excel formulas. Totals, percentages, and date differences need to recalculate and remain explainable. Use generated content for language tasks.

A formula is an executable claim

A formula records a business definition. Change the denominator and you change the metric. With revenue of 1200 and cost of 720, profit is 480. Profit divided by revenue gives a 40% margin. Profit divided by cost gives roughly 66.7% markup. Both describe profitability, but they aren't interchangeable. If the request says only "calculate profitability," Copilot has to choose the denominator. Name the metric and the denominator yourself.

Include the result and its definition, source columns, row or range context, and the expected treatment of blanks, zeros, and errors. Say whether you want only the formula or an explanation as well. Structured references keep the formula readable: inside a table, [@Revenue] means "Revenue in this row," so =([@Revenue]-[@Cost])/[@Revenue] exposes the calculation without cell coordinates. Also distinguish an empty cell from a formula that returns "". The latter looks blank but contains a formula, which means ISBLANK returns FALSE. If a later calculation must treat it as empty, test for ="".

Generate a gross-margin formula you can audit· excel
Bad example

Write a profitability formula for this row.

Good example

Create an Excel formula for the current row that calculates gross margin as (Revenue - Cost) / Revenue. Use structured references for the SalesData table, return a blank when Revenue is blank or zero, and return only the formula, with no explanation.

Why this works: A single current-row formula that guards the zero-revenue case and divides by Revenue, not Cost. Verify the denominator before you fill the column.

The COPILOT function is for language, not arithmetic

The =COPILOT() worksheet function doesn't perform an Excel calculation. It sends an instruction and cell context to Copilot, then places generated content in the cell. For example, =COPILOT("Classify this comment as Positive, Neutral, or Negative. Return exactly one label.", E2) reads the comment in E2. Down a column, the function can classify, summarize, extract, or rewrite text.

Give it a closed set of allowed outputs and ask for exactly one result. Without that constraint, the cells may contain punctuation, explanations, or labels you didn't request. Review the answers as well. "Good product, but support was slow" calls for judgment, so a person should read borderline cases before the labels feed a decision. Keep arithmetic out of =COPILOT() and in ordinary formulas. Generated text is a poor home for a total or percentage that you need to recalculate and reconcile.

Classify a column of comments· excel
Bad example

Label these customer comments by sentiment.

Good example

=COPILOT("Classify this customer comment as Positive, Neutral, or Negative. Return exactly one word and no punctuation or explanation.", E2)

Why this works: Exactly one on-list label per row, with the context reference advancing E2, E3, E4 down the column, and borderline cases flagged for a human read.

Never let generated text do arithmetic

A total or percentage an ordinary formula can compute should never come from =COPILOT() or a chat answer. Generated numbers can't be recalculated, tested, or reconciled the way a formula can. Keep =COPILOT() for language. Keep SUM, IF, and their kin for the math.

Verify every formula the same way

Verify every formula with the same routine. State what the result means, inspect each reference, and check the blank, zero, and error logic. Fill only the intended rows. Then use inputs whose answers are already known. Revenue 1200 and cost 720 must produce 40%. Revenue 850 and cost 900 must produce about -5.88%. Revenue 0 must display a blank. A result from a known input tells you more than a formula that merely looks plausible.

Excel may also suggest a formula while you type. On Windows, the switch is under File > Options > Copilot, labeled "Automatically generate formula suggestions." Treat the suggestion as a shortcut. Accept it only when it matches the formula you would write and uses the intended rows and operation. The setting controls whether suggestions appear. It doesn't check them for you.

Test a known value, not a plausible formula

Before you trust any generated formula, feed it inputs whose answer you already know and confirm the displayed result. A formula that returns 40% on revenue 1200 and cost 720 has earned some trust. One that merely looks correct has not.

Generation and explanation are two jobs

Generating a formula and explaining one are different tasks, and keeping them separate is a safeguard. Ask Copilot to generate when you know the business rule but need the syntax. Ask it to explain when you've inherited a workbook and want to know what a cell does: "Explain the formula in the selected cell in plain language, list the columns and ranges it uses, describe how it handles blanks and zeros, and give me two test cases. Do not change the workbook."

An explanation is a claim too. Compare Copilot's description against the formula bar. If it calls a division by cost "margin," the description and the formula disagree, and one of them is wrong. Then confirm with a live test: change an input to a value whose result you know and watch the cell update. If the workbook matters, keep the prompt, the accepted formula, and any correction together, so the next person can see what the formula is and why you trusted it.

Delegate multi-step edits, with guardrails

Sometimes the task includes more than one formula. You may want Copilot to format columns, add a calculated column, highlight rows, and sort the table in one request. Edit with Copilot is Excel's agentic editing experience. Microsoft previously called it Agent Mode, and the agentic capabilities across Word, Excel, and PowerPoint became generally available on April 22, 2026. It can carry out a sequence of workbook changes from one request, so the boundary needs to be explicit.

Bound each edit with a goal, context, source, and expectations, and define any business term rather than letting Copilot infer it. "Margin," "at risk," and "late" mean different things in different organizations, so give the exact formula, threshold, or status text. Before editing, write down two or three invariants, such as the row count, a key total, the Order IDs, or the requirement that existing formulas survive, and always work on a copy. Then treat "plan, execute, inspect, approve" as your own workflow, not a guaranteed product mode: inspect the workbook itself afterward, because a fluent completion report can describe changes that didn't happen or miss changes that did. Verify the totals and formulas, not the narrative.

A bounded multi-step edit· excel
Bad example

Clean up this Orders sheet and highlight risky rows.

Good example

Edit only the Orders table on the Orders sheet. Format Revenue and Cost as currency with two decimals. If Margin % is missing, add it as (Revenue - Cost) / Revenue, leaving it blank when Revenue is zero. If it already exists, do not overwrite it. Highlight rows whose Status is exactly "At risk." Sort by Region A–Z, then OrderDate newest to oldest. Preserve every Order ID, value, and formula, and do not delete rows or rename columns. Report presentation changes separately from data or formula changes.

Why this works: A formatted, sorted table with risk rows highlighted and a change report, which you verify against your recorded invariants (row count, totals, IDs) before saving.

Verify the workbook, not the report

Edit with Copilot returns a tidy summary of what it did. Don't trust it. Work on a copy, record your invariants first, and after the edit recompute the totals and spot-check formulas in the first, middle, and last rows. If a total moved or an ID changed, the result fails no matter how polished it looks.

Try it yourself

Generate and trust-test a formula

Take a formula from prompt to proof in a few minutes, using inputs whose answers you already know.

  1. 01

    Build a small table with Units, UnitPrice, and Discount columns, and add an empty NetSales column.

  2. 02

    Ask Copilot for a current-row formula computing Units * UnitPrice * (1 - Discount), returning blank when Units is zero, using structured references.

    Hint: Ask for only the formula, no explanation.

  3. 03

    Before filling, read the formula: does it multiply the right three fields and guard the zero-units case?

  4. 04

    Fill it down, then test a known row: 12 × 8.50 × (1 − 0.10) should show 91.80, and confirm a zero-units row shows blank, not 0.

    Hint: A visually blank cell still holds a formula, so ISBLANK reports FALSE.

  5. 05

    Ask Copilot to explain the formula without changing the workbook, and check its description matches what the cell does.

A verified NetSales column plus a formula you can explain line by line, and the habit of testing a known value before trusting any generated formula.

Key takeaways

  • A formula encodes a business definition, so always name the metric and its denominator.
  • Use ordinary formulas for deterministic math and the COPILOT function for language work like classification.
  • A visually blank result from "" still contains a formula, so ISBLANK returns FALSE.
  • Test a formula on known inputs. A plausible formula or explanation is not proof.
  • Bound agentic edits with invariants, work on a copy, and verify the workbook, not the report.

Check your understanding

  1. 1. You need gross margin from Revenue and Cost, and separately need to sort messy customer comments into Positive, Neutral, or Negative. Which tools fit?

  2. 2. Revenue is 1,200 and Cost is 720, so profit is 480. Your formula divides 480 by 720. What did you calculate?

  3. 3. A cell shows blank because its formula returns "". What does ISBLANK report for that cell?

  4. 4. A manager asks Edit with Copilot to "clean up the Orders workbook and flag risky rows." What makes this an auditable request?

  5. 5. Excel offers a formula suggestion as you extend a column. What's the right response?

Frequently asked questions

Terms used in this lesson

structured reference
A way to refer to table data by column name, where [@Revenue] means the Revenue value in the current row.
COPILOT function
The =COPILOT(instruction, context) worksheet function that returns generated content, used for language tasks, not deterministic arithmetic.
visually blank result
A cell that displays nothing because its formula returns "", even though the cell still contains a formula.
Edit with Copilot
Excel's agentic editing experience that carries out a sequence of workbook changes from one request. Formerly called Agent Mode.
invariant
A condition that must stay true after an edit, such as a fixed row count, total, or set of IDs.

Further reading