Excel Formulas for Sales Analysis: Copilot Writes, You Check

Coding Liquids tutorial cover featuring Sagnik Bhattacharya for Excel Formulas for Sales Analysis: Copilot Writes, You Check.
Coding Liquids tutorial cover featuring Sagnik Bhattacharya for Excel Formulas for Sales Analysis: Copilot Writes, You Check.

The Excel formulas that matter most for sales analysis are SUMIFS for revenue by product, channel or month, COUNTIFS for order counts, AVERAGEIFS for average order value, XLOOKUP for pulling prices or categories, and a PivotTable for summaries. Have Copilot draft each one from a prompt that names your columns, then check it against a hand-worked sample.

The Complete Excel Course with AI Integration

From formulas and pivot tables to Power Query, DAX, VBA and AI with Copilot, ChatGPT and Claude — hands-on from the first lesson.

By Sagnik Bhattacharya and Virginia Thorn, Primetime Emmy Award winner

Buy now

Formula syntax is rarely what goes wrong. Definitions are. Copilot cannot know that refunded jobs should not count as revenue, that your average should be per order rather than per line, or that "January" means the order date rather than the payment date, unless the prompt says so. Most errors in AI-written sales formulas are a missing condition that a ten-row sample exposes in minutes.

Which Excel formulas answer which sales questions?

Each common sales question maps to one Excel formula or tool, and naming that pairing in your prompt gets Copilot to the right answer faster. Here are the pairs most small businesses need:

QuestionFormula or toolPattern (simplified)
How much did we sell of X, in a channel, in a month?SUMIFS=SUMIFS(Value,Service,"Patio",Status,"Paid")
How many orders or jobs?COUNTIFS=COUNTIFS(Status,"Paid",Date,">="&H1)
What is the average order value?AVERAGEIFS, or revenue divided by order count=AVERAGEIFS(Value,Status,"Paid") if each row is one order
What category or price belongs to this product?XLOOKUP=XLOOKUP([@Product],Products[Name],Products[Category],"Not found")
Which customers or products appear in the data?UNIQUE=UNIQUE(Sales[Customer])
Revenue by month and channel in one tablePivotTable, or PIVOTBY in Excel for Microsoft 365Ask Copilot for "a PivotTable of Value by Month and Channel"
Totals by one field, as a formulaGROUPBY (Excel for Microsoft 365 only)=GROUPBY(Sales[Channel],Sales[Value],SUM)
Each channel's share of the totalSimple division=H2/SUM($H$2:$H$4)

Versions matter. XLOOKUP is not available in Excel 2016 or 2019; UNIQUE needs Excel 2021, 2024, Microsoft 365 or the web; GROUPBY is listed for Excel for Microsoft 365 only. If anyone who opens the workbook uses an older Excel, ask Copilot for SUMIFS and a PivotTable instead of the newer functions. Microsoft's own note on PIVOTBY is worth knowing: despite the name, it is not related to the PivotTable feature, though it produces similar summaries.

How should sales data be laid out before Copilot writes formulas?

Sales data should sit in one Excel table with one row per order or job line, real dates, numbers stored as numbers and a status column. Every formula and Copilot prompt depends on clean, consistently named columns, and twenty minutes here saves hours of puzzling over wrong totals.

  1. Put the data on its own sheet and convert it to a table: select any cell and press Ctrl+T. Name it something short, such as Sales.
  2. Use one header row with plain names: Date, Customer, Service, Channel, Status, Value. Copilot's own tip is that naming the columns you want analysed produces more accurate results, and short names make prompts easier to write.
  3. Make sure dates are real dates and values are numbers. Select a few cells: the status bar shows a sum and average only for numbers, so if it shows just a count, the values are stored as text.
  4. Add a Status column (Paid, Refunded, Cancelled) rather than deleting refunded rows. Deleted rows cannot be analysed later; a status can be filtered.
  5. Remove subtotal or total rows from inside the data. A "January total" row in the middle of the table gets counted twice by every SUMIFS.
  6. Save the file to OneDrive or SharePoint and leave calculation on Automatic, which Copilot needs before it can edit the workbook.

If your sales arrive as a messy monthly export from a till or booking system, tidy it first: cleaning a monthly sales export walks through the usual problems, and merging two Excel files with Copilot covers combining a sales list with a product or customer list.

How do you prompt Copilot to write a sales formula?

A sales formula prompt works when it states the measure, every condition, where the result goes, and which input cells hold dates or rates. Open the Copilot pane from the icon in the lower-right corner of Excel and write the prompt as if briefing a new bookkeeper.

In the Summary sheet, cell C4, write a formula for paid revenue from
the Sales table: sum Sales[Value] where Sales[Status] is "Paid" and
Sales[Date] is on or after the date in C1 and on or before the date in C2.
Use SUMIFS. Do not type any dates into the formula; reference C1 and C2.
Then explain the formula in one sentence.

An illustrative first answer came back as =SUMIFS(Sales[Value],Sales[Date],">="&C1,Sales[Date],"<="&C2) with the explanation "Adds the values of all sales between the two dates." The explanation is accurate, and that is the problem: the Status condition is missing, so refunded and cancelled jobs count as revenue. The fixed version adds Sales[Status],"Paid" as a further pair. SUMIFS takes up to 127 range and criteria pairs, so conditions are cheap; leaving one out is what costs you.

Three more prompts worth keeping, each with the trap to check:

  • "Add a column to the Sales table that looks up each service's category from the Services table with XLOOKUP, returning 'Not found' if missing." Check: filter the new column for "Not found"; every hit is a spelling difference between the two tables.
  • "In the Summary sheet, show paid revenue by channel as a PivotTable." Check: the PivotTable's grand total must equal your paid-revenue cell. If it is higher, the Status filter was not applied.
  • "Add a column that shows each channel's percentage of total paid revenue." Check: the percentages should add to 100%. Microsoft lists a near-identical prompt ("each region's percentage of total sales") among its examples.

A landscaping company's quarter, checked against a 12-row sample

To see the method end to end, take an illustrative landscaping company that wants its first-quarter figures. Before letting Copilot loose on 900 rows, the owner copies a 12-row sample into a test sheet, including the awkward cases, and works out the answers by hand.

DateServiceChannelStatusValue ($)
3 JanPatioWebsitePaid2,400
7 JanPlantingReferralPaid650
12 JanLawn careRepeatPaid120
19 JanPatioReferralRefunded1,800
28 JanPlantingWebsitePaid900
2 FebLawn careRepeatPaid120
10 FebPatioWebsitePaid3,100
15 FebDesignReferralPaid450
21 FebPlantingWebsiteCancelled700
2 MarLawn careRepeatPaid120
9 MarPatioReferralPaid2,750
25 MarPlantingWebsitePaid1,050

The hand-worked answers: paid revenue is $11,660 across 10 paid jobs ($14,160 if refunded and cancelled jobs are wrongly included). By month, January is $4,070, February $3,670 and March $3,920, which add back to $11,660. Paid patio revenue is $8,250. By channel, Website brings $7,450 (63.9%), Referral $3,850 (33.0%) and Repeat $360 (3.1%). The average paid job is $11,660 ÷ 10 = $1,166.

MeasureHand answerCopilot's first formula gaveCauseFixed?
Paid revenue$11,660$14,160No Status conditionAdded Status = "Paid"
Paid patio revenue$8,250$8,250NoneAlready right
January paid revenue$4,070$5,870Same missing condition, plus the refunded patio jobAdded Status
Paid job count1010NoneAlready right
Average paid job$1,166$1,180AVERAGE over all 12 rowsSwitched to AVERAGEIFS with Status
Channel shares63.9 / 33.0 / 3.1%Added to 100%Correct once revenue was fixedRechecked

The results are illustrative, but the pattern is typical: the formulas that need one condition were right, and the ones that needed a business definition (what counts as revenue) were wrong in the same way. Note how small the average-job error looks: $1,180 against $1,166 is just over 1%, and nobody would spot it on the full data. On the sample, with the answer written down beforehand, it is obvious. With the formulas fixed on the sample, the owner points them at the full table, and the reconciliation checks below confirm the totals hold.

If you want help fitting sales reporting in Excel into how your business runs, I offer one-to-one AI consultations for small businesses.

Comparing one month with the last

Month-on-month growth is a one-line formula, and the sample makes it easy to check. With February's paid revenue in one cell and January's in another, growth is February minus January, divided by January: ($3,670 − $4,070) ÷ $4,070 = −9.8%. March against February is ($3,920 − $3,670) ÷ $3,670 = +6.8%. Two details are worth putting in the prompt. Ask Copilot to keep the start and end dates of each month in their own cells, so next quarter only the dates change. And ask for a growth formula that shows a blank or a short message when the earlier month is zero, because dividing by a month with no sales returns #DIV/0!, which IFERROR can turn into "No sales last month".

A second example: a tutoring centre's enrolments by course

The same method works for counts as well as money. An illustrative tutoring centre keeps one row per enrolment with Date, Student, Course, Type (New or Returning) and Fee. The owner wants new enrolments per course in September and the fee income they bring. Six sample rows are enough to test the logic:

DateStudentCourseTypeFee ($)
2 SepStudent AMathsNew320
4 SepStudent BMathsReturning320
9 SepStudent CEnglishNew280
15 SepStudent DMathsNew320
22 SepStudent ESciencesReturning350
3 OctStudent FMathsNew320

By hand, September has two new Maths enrolments (A and D) worth $640, and one new English enrolment worth $280; Student F is October and must not count. Copilot's illustrative first COUNTIFS for "new Maths enrolments in September" returned 3, because it filtered on Course and Type but forgot the date range, so the October row slipped in. Adding the two date conditions brought it to 2. Its SUMIFS for the fee was right first time, because the prompt for that one happened to mention September explicitly. The lesson is the same as with the landscaping data: every condition you have in your head must be written in the prompt, and the sample must contain a row that tests each one, here a row from the wrong month.

A prompt library worth saving

Once a prompt has produced a formula that passed the sample, save the wording. These are the ones most owners reuse, with the check that goes with each:

Prompt (shortened)Copilot should produceCheck against the sample
Paid revenue between the dates in C1 and C2SUMIFS with Status and two date conditionsMatches the hand total; refunded rows excluded
Paid jobs between the same datesCOUNTIFS with the same three conditionsMatches the hand count
Average paid order valueRevenue divided by order count, or AVERAGEIFS if one row per orderMatches revenue ÷ count from the sample
Category for each product from the Products tableXLOOKUP with an if-not-found messageNo "Not found" rows, or each explained
Revenue by channel as a PivotTablePivotTable filtered to PaidGrand total equals paid revenue
Growth on the previous monthDifference divided by last month, error-safeMatches the hand percentage

Keep the library on a sheet in the workbook itself. When a colleague asks for "sales by channel for last quarter", they start from wording that already handles refunds and dates, instead of a fresh prompt that may not.

How do you check Copilot's sales formulas on the full data?

Copilot's sales formulas are checked on the full data with reconciliations: totals split different ways must add back to the same grand total, and each formula's inputs must trace to the right columns. Run these after the sample test passes.

  1. Split-and-add. Revenue by month, by channel and by service should each add up to the same paid-revenue total. If one split falls short, rows are missing a month, channel or service value.
  2. Status count. COUNTIFS for Paid plus Refunded plus Cancelled should equal the number of rows. A shortfall means a status spelt differently somewhere ("paid", "Paid ").
  3. Status bar spot check. Filter the table to one service and status, select the Value cells, and read the sum in the status bar. It should equal the formula's answer for that pair.
  4. Show formulas. Press Ctrl + ` to show formulas and confirm summary cells reference the table columns, not fixed ranges such as A2:A900 that will miss next month's rows.
  5. Trace and evaluate. For any surprising figure, select it and use Formulas, Trace Precedents to see where it draws from, then Evaluate Formula to step through it one part at a time.
  6. Ask for an explanation, then compare. In Chat only mode, ask Copilot to "explain the formula in cell C4". If the explanation leaves out a condition you expect, the formula leaves it out too.

If building these reconciliation checks is the slow part, try The Complete Excel Course with AI Integration on Coding Liquids.

When should you use a PivotTable instead of formulas?

A PivotTable is the better choice for exploring sales from several angles quickly; formulas are better for a fixed summary sheet whose cells you reference elsewhere, such as a monthly report or a dashboard. Copilot can produce either, so choose by how the numbers will be used.

NeedBest toolWhy
"Show me revenue by every combination" explorationPivotTableDrag fields around without writing formulas
A monthly report with fixed cellsSUMIFS and COUNTIFSEach number sits in a known cell other sheets can use
A summary that grows with the data, as a formulaGROUPBY or PIVOTBY (Microsoft 365)Spills a summary table that updates with the source
A dashboard for othersFormulas feeding chartsStable layout; see the dashboard tutorial linked below
Sharing with someone on Excel 2019SUMIFS or a PivotTableNewer functions won't calculate in older versions

Whatever you choose, ask Copilot by format: Microsoft's guidance is to name the format, such as a PivotTable, in the prompt. When Copilot builds a summary for a dashboard, the errors to expect are covered in what Copilot gets wrong in a sales dashboard.

Which errors show up in Copilot-written sales formulas?

The errors in Copilot-written sales formulas are mostly missing conditions, text that looks like numbers or dates, ranges that do not line up, and averages taken at the wrong level. Each has a recognisable symptom.

SymptomLikely causeFix
Revenue higher than the bank showsRefunds or cancellations countedAdd a Status condition
SUMIFS returns 0Dates or values stored as text, or a criterion spelt differentlyConvert to real dates and numbers; tidy spellings
#VALUE! from COUNTIFS or AVERAGEIFSCriteria ranges of different sizesMicrosoft requires matching sizes; use table columns
#DIV/0! from AVERAGEIFSNo rows meet the criteriaExpected for an empty month; wrap with IFERROR to show a message
#N/A from XLOOKUPProduct not found in the lookup tableUse the if-not-found argument and fix the spelling
Average order value too lowEach row is a line item, not an orderDivide revenue by COUNT of unique order IDs
Next month's sales missingFormula uses fixed ranges like A2:A900Reference table columns, which grow with the data
Date range off by a day"<" used where "<=" was meantCheck boundary dates in the sample

The average-order-value trap deserves a closer look because it is easy to miss. If an order for patio slabs, sub-base and labour is three rows, AVERAGEIFS on Value averages lines, not orders, and understates the true order value. Count orders with =ROWS(UNIQUE(FILTER(Sales[Order ID],Sales[Status]="Paid"))) in Excel 2021 or later and divide paid revenue by that count.

How do you get insights from Copilot, not just formulas?

Copilot gives sales insights when you ask a business question about named columns and say how you want the answer shown. Microsoft's own examples include "Which region had the highest and lowest sales?" and "Are there any outliers or anomalies in this data?", and Copilot can answer with charts, PivotTables, summaries, trends or outliers.

Questions that tend to be useful for a small business:

  • "Using the Sales table, which three services grew most between January and March in paid revenue? Show a small table."
  • "Are there any customers whose paid spend dropped by more than half compared with the previous quarter?"
  • "Show paid revenue by channel by month as a PivotTable and a line chart."
  • "List any paid jobs with a value more than three times the average for that service."

Here is what that looks like on the landscaping sample. Asked "Using the Sales table, which channel's paid revenue grew most from January to March?", an illustrative answer read: "Referral grew the most, from $650 in January to $2,750 in March, an increase of $2,100. Website fell from $3,300 to $1,050, and Repeat stayed at $120." Every figure in that answer can be checked against the hand-worked table in under a minute: January referral is $650 only because the refunded $1,800 patio job is excluded, and January website is $2,400 plus $900. Had Copilot quoted January referral as $2,450, you would know at once that the refund had crept back in, and that any formula built on the same reading needs the Status condition too.

Treat insights like formulas: each one rests on a calculation you can see and check. If Copilot says Referral revenue grew 40%, ask it to show the two figures it compared, then confirm one of them against your sample or a filtered status-bar sum. On a commercial Copilot licence or Microsoft 365 Premium, Copilot in Excel also lets you switch between Claude and GPT models, or leave it on Auto; trying the same question on a second model is a cheap way to spot an answer that depends on a misreading. For broader analysis ideas, see Copilot for data analysis.

What does a reusable sales check sheet look like?

A reusable sales check sheet holds your hand-worked sample answers next to the live formulas, so every time Copilot changes a formula you can see whether the sample still gives the right numbers. Build it once, keep it in the workbook, and rerun it monthly.

CheckExpected (sample)Formula resultPass?
Paid revenue, quarter11,66011,660=IF(C2=B2,"PASS","CHECK")
Paid revenue, January4,0704,070PASS
Paid jobs1010PASS
Average paid job1,1661,166PASS
Channel shares add to 100%100%100%PASS
Month split adds to quarter11,66011,660PASS

Point the formula-result column at a copy of your summary formulas that reads the sample sheet instead of the full table. A row turning to "CHECK" after an edit tells you which definition has drifted before the wrong number reaches a report. If the workbook came from someone else and you need to understand its formulas before trusting them, explaining an inherited formula with Copilot covers that audit, and the licence you need for any of this is set out in Copilot in Excel pricing.

Sales formulas and Copilot: follow-up questions

Which Excel formula is best for sales by month?

SUMIFS with a date range is the most flexible: sum the Value column where the date is on or after the first of the month and on or before the last, plus any status condition. For a quick table of every month at once, ask Copilot for a PivotTable grouped by month, or use GROUPBY if you have Excel for Microsoft 365.

Can Copilot in Excel make a PivotTable from my sales data?

Yes. Microsoft says Copilot in Excel can create and edit PivotTables with editable links to the source data, and that you should name the format in your prompt, for example 'show revenue by channel and month as a PivotTable'. Check the PivotTable's grand total against a SUM of the Value column before using it.

Why does my SUMIFS return zero?

Usually because the criteria never match. Dates or numbers stored as text, product names with trailing spaces, a status spelt differently ('paid' versus 'Paid ') or criteria ranges pointing at the wrong column all produce zero. Test one criterion at a time, and check a suspect cell's format with the number shown in the status bar.

Is XLOOKUP better than VLOOKUP for sales data?

Yes, where it is available. XLOOKUP matches exactly by default, can return columns to the left of the lookup column, and has an if-not-found argument for a clear message instead of #N/A. It is not available in Excel 2016 or 2019, so anyone on those versions sees broken cells in a workbook that relies on it.

How many rows should I check by hand?

Ten to twenty rows are enough if they cover every category, every status (paid, refunded, cancelled), at least two months and one awkward case such as a zero-value line. Work out the expected answers on paper or with a calculator, then compare each Copilot formula's result with your figure before trusting it on the full data.

Further reads

Sources: Microsoft Support pages for SUMIFS, COUNTIFS, AVERAGEIFS, XLOOKUP, UNIQUE, GROUPBY, PIVOTBY and IFERROR; Get data insights with Copilot in Excel; Get started with Copilot in Excel; Copilot in Excel FAQ; Evaluate a nested formula; Display the relationships between formulas and cells; Display or hide formulas; View summary data on the status bar. Read 23 November 2026.

Want a second pair of eyes on your setup?

Bring the process you're trying to fix. On a 1:1 call we'll work out which AI tools should handle it, which parts stay manual, and how to roll it out without disrupting the team.

Book a 1:1 call with me