AI Excel Data Analysis
AI Excel Data Analysis
Previously, I worked in e-commerce operations and had to open Excel every weekend to organize the week's sales data.
I needed to check how many units of each product were sold, which sales had the highest revenue, if there were any abnormal orders, and finally create a chart to report to the manager.
If the data only had a dozen rows, manual calculation wouldn't be too troublesome. But if there were hundreds of orders every day, resulting in thousands of records in a week, just organizing the spreadsheet would be a hassle.
Now, AI can help us complete these repetitive tasks:Reading Excel, checking data, calculating sales revenue, summarizing by product, generating charts, and finally outputting an editable XLSX file.
This chapter uses a simple e-commerce sales case to learn how to use AI tools with corresponding capabilities like ChatGPT, WorkBuddy, and DuMate to transform raw sales details into a complete Excel sales analysis report.
I. What Excel tasks can AI help us with
Excel is not just for recording data; more importantly, it is about extracting valuable information from data through formulas, summaries, and charts.
AI can help us complete the following common tasks:
| Application Scenarios | Tasks AI can perform |
|---|---|
| ** Data Organization | Standardizing field, date, and number formats, checking for null values |
| ** Formula Calculation | Generate formulas such as SUM, SUMIF, and SUMIFS |
| ** Categorical Summarization | Statistics by product, date, or department |
| ** Data Visualization | Generate bar charts, line charts, and pie charts |
| ** Anomaly Detection | Check for negative numbers, null values, abnormal prices, and suspected duplicate records |
| ** Analysis Report | Summarize the core conclusions based on the statistical results |
For example, we can directly tell the AI:
Analyze this sales Excel for me, count sales volume and revenue by product, find the best-selling product, check for abnormal records, and create a bar chart.
If the tool supports Excel file processing, it can read the data and perform statistics according to the requirements, and generate a new workbook.
However,the numbers provided by the AI still need to be verified using Excel formulas or programsand data correctness cannot be judged solely based on the text conclusions generated by the model.
II. First, understand three Excel data analysis concepts
Before starting the operation, first understand the concepts of statistical scope, data aggregation, and Excel formulas.
1. What is statistical scope
Statistical scope is the rule we use when calculating data.
For example, "best-selling product" can be understood in at least two ways:
- **By sales volume:** Which product has the highest number of units sold.
- **By sales revenue:** Which product generates the highest sales amount.
These two results are not necessarily the same.
One mouse might sell 100 units at 50 RMB each; another computer might only sell 5 units at 5000 RMB each. The former has a higher quantity, while the latter has a higher sales revenue.
Therefore, before analysis, we must first state:Whether we rank by sales volume or by sales amount.
2. What is data aggregation
Original sales data usually represents one sales record per row.
For example, the same type of mouse might sell 3 units on Monday and 1 unit on Thursday.
If you want to know the total number of mice sold this week, you need to merge and count multiple records.
This is data aggregation.
3. Common Excel formulas
| Function | Purpose | Use case |
|---|---|---|
SUM |
Summing numbers | Calculating total sales |
SUMIF |
Summing based on a condition | Summarizing sales by product |
SUMIFS |
Summing based on multiple conditions | Statistics the sales amount of a certain product within a specified date range |
COUNTIF |
Statistics the number of cells that meet the conditions | Statistics the number of records where a certain product appears |
SUMPRODUCT |
Calculates the sum after multiplying the array | Calculates the total amount of quantity and unit price |
You do not need to memorize all the formulas at once. Later, AI can generate formulas based on actual data, and Excel can execute the calculation.
III. Practical Scenarios: Analyzing Weekly E-commerce Sales Data
Assume you are in charge of a small online store and need to report on this week's product sales in the weekly meeting.
There is currently a sales detail report that includes date, product, sales quantity, and unit price.
To make it easier for beginners to follow along, we will first use five simulated records.
| Date | Product | Quantity (units) | Unit Price (Yuan) |
|---|---|---|---|
| Monday | Laptop | 2 | 30 |
| Tuesday | Mouse | 3 | 50 |
| Wednesday | Laptop | 1 | 30 |
| Thursday | Mouse | 1 | 50 |
| Friday | Keyboard | 2 | 100 |
"Notebook" here refers to a physical notebook, not a laptop computer.
The following statistical rules are uniformly adopted for this time:
- Quantity represents the actual number of units sold.
- Sales amount for each record = Quantity × Unit Price.
- Summarize sales quantity and sales amount by product.
- Sales amount is in RMB, unit is Yuan.
- Profit, return rate, and sales growth rate are not calculated because there is no corresponding data.
What needs to be generated this time
| Deliverables | Specific requirements |
|---|---|
| Product Sales Summary Table | Includes product, sales volume, sales amount, and ranking |
| Sales Amount Bar Chart | Shows the sales performance of different products |
| Data checking results | Lists records with null values, negative numbers, and those requiring verification |
| Analysis conclusions | Describes sales performance and issues that need attention |
| Excel file | Generates an editable XLSX workbook |
The entire workflow is as follows:
Four, Step 1: Let AI check the sales data
In practical work, do not rush to calculate after receiving an Excel file.
Because some spreadsheets may contain blank cells, duplicate records, amounts in text format, or even abnormal data with negative quantities.
If you summarize directly, the results may be biased.
You can first give the raw data to AI to check the data quality.
Example: Checking sales data
You are an e-commerce data analyst.
Please check the following simulated sales details:
Date,Product,Quantity,Unit Price
Monday, laptop, 2, 30
Tuesday, mouse, 3, 50
Wednesday, laptop, 1, 30
Thursday, mouse, 1, 50
Friday, keyboard, 2, 100
First check the data, do not write the analysis conclusion directly.
Checking content:
How many records there are in total.
Whether there are null values.
Whether the quantity and unit price are valid numerical values.
Whether there are negative numbers or zero values.
Whether there are suspected duplicate records.
Whether there are missing fields required for analysis.
Please display the check results in a table.
Do not delete or modify the original records yourself.
Expected check results
Checking these five simulated data records confirms that:
- There are a total of 5 sales records.
- There are 3 types of products included.
- Both quantity and unit price are positive numbers.
- There are no blank fields.
- There are no identical detail lines.
However,The absence of an order number does not mean that duplicate orders cannot exist.
If the same order is entered multiple times, but the date, quantity, or other fields have slight variations, it is difficult to determine accurately using only the current four fields.
Therefore, real e-commerce analysis is best done by retaining fields such as order ID, order status, and payment amount.
V. Step Two: Let AI calculate sales and summarize
After confirming that the data has no obvious formatting issues, you can have AI calculate the sales amount for each record and then summarize by product.
Example: Product Sales Volume and Sales Amount Summary
Based on the sales details confirmed just now,
complete the product sales statistics.
Calculation rules:
Sales amount per item = Quantity × Unit price.
Group and summarize by product name.
Statistics for sales quantity and sales amount separately.
Sort by sales amount from highest to lowest.
Calculate the total sales volume and total sales amount for all products.
Products with the same sales amount are allowed to have tied rankings.
Output:
I. Product Sales Summary Table
Fields: Product, Sales Volume, Sales Revenue, Rank
II. Overall Statistics
Number of Sales Records
Number of Product Categories
Total Sales Volume
Total Sales Revenue
III. Analysis Conclusions
Describe the main findings in under 100 words.
Note:
The currency unit is RMB Yuan.
Do not fabricate profits, returns, or growth rates.
Do not confuse the number of sold items with the number of orders.
All results must be verifiable against the original data.
Correct summary of product sales
Based on the original data, the following results can be obtained:
| Product | Sales (units) | Sales amount (CNY) | Rank |
|---|---|---|---|
| Keyboard | 2 | 200 | 1 |
| Mouse | 4 | 200 | 1 |
| Laptop | 3 | 90 | 3 |
| Total | 9 | 490 | - |
From the results, it can be seen that:
- Based on the number of units sold, the mouse sold the most, with a total of 4 units.
- Based on sales revenue, the keyboard and mouse tied for first place, both at 200 yuan.
- The sales revenue for the laptop was 90 yuan.
- In total, 9 items were sold, with a total sales revenue of 490 yuan.
A common error occurs here:If the sales of keyboards and mice are the same, a single top rank should not be forced.
The two types of products can be displayed sorted by a secondary field, but the sales ranking should remain tied.
VI. Step 3: Verify calculation results using Excel formulas
Although the calculation results provided by AI seem fine, they should still be checked with formulas in actual work.
Especially with thousands of sales records, one cannot rely solely on the model to calculate the numbers.
1. Calculate the sales amount for each transaction
Assuming the original details are stored in columns A to D in Excel:
| Column | Field |
|---|---|
| A | Date |
| B | Product |
| C | Quantity |
| D | Unit Price |
| E | Sales Amount |
Enter in cell E2:
Calculate the sales amount per transaction
=C2*D2
Then drag the formula down to calculate the amount for each sales record.
In this example, E2 to E6 are:
Sales calculation results
60
150
30
50
200
2. Calculate total sales
The simplest way is to use SUM:
Calculate the total sales amount
=SUM(E2:E6)
The result is:
490 Yuan
If you don't want to add a sales amount column for now, you can also use SUMPRODUCT to directly calculate the sum of the products of quantity and unit price:
Calculate using SUMPRODUCT
=SUMPRODUCT(C2:C6,D2:D6)
The results of the two formulas should be consistent.
3. Summarize sales by product
Assuming cell G2 contains the product name "Mouse", you can use:
Summarize sales quantity by product
=SUMIF($B$2:$B$6,G2,$C$2:$C$6)
The formula means: find the product in B2 to B6 that matches G2, and sum the corresponding quantities in column C.
If G2 is "Mouse", the result is 4.
4. Summarize sales revenue by product
Still using the product name in G2 as the condition:
Summarize sales by product
=SUMIF($B$2:$B$6,G2,$E$2:$E$6)
If G2 is "Mouse", the result is 200.
When the data volume is large, you can convert the details into an Excel table and use structured references, which makes the formula easier to extend after adding new sales records.
VII. Step 4: Let AI automatically create sales charts
After having the product sales summary table, you can also generate charts.
For this case, a bar chart is most suitable because we want to compare the sales of different products.
Product Sales Comparison
<chart content="{{"chartType":"bar","meta":{"footer":"Calculated based on 5 simulated sales records from this lesson. Keyboard and mouse sales are tied for first._},xkey:Product,series:[{datakey:Sales revenue,label:Sales revenue,valuesuffix:_ Yuan_}],yaxismin:0,data:[{Product:Keyboard,Sales:200},{Product:Mouse,Sales revenue:200},{Product:Laptop,Sales revenue:90}]}}>
It can be intuitively seen from the chart that the sales of mice and keyboards are the same, while laptops are relatively lower.
If you ask AI to generate an Excel file, you can request that this bar chart be inserted directly into the workbook, instead of just outputting an image.
Example: Generate a sales chart in Excel
create an Excel bar chart.
Requirements:
1.The horizontal axis is the product name.
2.The vertical axis is sales revenue, in Yuan.
3.The chart title is "Product Sales Comparison".
4.Display data labels.
5.Data starts from 0.
6.Keep product names complete and readable.
7.Charts should directly reference data from the sales summary table.
8.Place charts in the "Sales Analysis" worksheet.
Do not use manually drawn static images
Instead, use editable Excel charts.
If the current tool cannot create native charts,
please state this clearly and provide an alternative solution.
This workbook can continue to maintain the charts after modifying the source data and updating the summary results.
If the chart references a fixed range, the data range needs to be extended when adding new products; using dynamic data sources like Excel spreadsheets can reduce this type of maintenance work.
VIII. Step Five: Check for Abnormal Sales Records
Data analysis is not just about finding the best-selling products; it also requires checking if there are any data issues.
For example, a real sales Excel might show:
- A negative quantity without a corresponding return explanation.
- Unit price is 0, it might be a free gift or an entry error.
- Product name is empty.
- The same order number appears repeatedly.
- Product price is significantly deviated from common prices.
These records cannot be directly identified as errors, and AI should not delete them arbitrarily.
The correct approach is:First flag the anomaly, then verify according to business rules.
Example: Check abnormal sales data
Check rules:
1.Whether the product name is empty.
2.Whether the quantity is empty or not a number.
3.Whether the unit price is empty or not a number.
4.Whether there are negative numbers.
5.Whether there are records with a quantity of 0.
6.Whether there are records with a unit price of 0.
7.Whether there are completely identical detail lines.
8.If there is an order number, check for suspected duplicate orders.
Output an exception record table:
Row number|Product|Exception type|Exception description|Suggested handling
Requirements:
-Only mark when an exception is found.
-Do not delete the original record yourself.
-Do not directly determine negative numbers as errors.
-Do not directly determine all duplicate rows as duplicate orders.
-Do not fabricate missing order numbers.
-If there are no exceptions, clearly state the check results.
Mark all undetermined cases as "To be verified".
Are there any anomalies in this simulated data?
Checked these five records and found no null values, negative numbers, zero quantities, zero unit prices, or completely identical detail rows.
However, due to the lack of fields such as order number and order status, further judgment on duplicate orders, refunds, or actual transaction anomalies cannot be made.
Therefore, this analysis can output:No field-level anomalies were found; order-level anomalies cannot be determined at this time.
IX. Step Six: Generate the actual Excel file
The previous steps have completed the calculation, analysis, and chart design.
However, simply displaying the results in the chat window does not complete the entire office task.
What we really need is a file that can be downloaded, edited, and continued to be used..xlsxYou can use ChatGPT or an office Agent with table generation capabilities to create the workbook.
Suggested Excel workbook structure
Worksheet
| Content | Content |
|---|---|
| Raw data | Save five sales details and add sales amount calculation column |
| Product summary | Statistics of sales volume, sales amount, and ranking by product |
| Sales analysis | Display core indicators, analysis conclusions, and bar charts |
| Anomaly check | Record anomaly type and items to be verified |
These four worksheets solve different problems: raw data for tracing, product summary for calculation, sales analysis for reporting, and anomaly check for data quality management.
Let AI generate XLSX
Example: Generate a complete Excel sales analysis file
generate a real Excel workbook.
File name:
RUNOOB-Sales Data Analysis.xlsx
Please create four worksheets:
I. Raw Data
Retain original sales records:
Date,Product,Quantity,Unit Price
Monday,Laptop,2,30
Tuesday,Mouse,3,50
Wednesday,Laptop,1,30
Thursday,Mouse,1,50
Friday,Keyboard,2,100
Add "Sales Amount" column,
Use Excel formula to calculate Quantity × Unit Price.
II. Product Summary
Statistics by product:
-Units Sold
-Sales Amount
-Sales ranking
Generate statistical results using Excel formulas.
III. Sales Analysis
Display:
-Number of product types
-Total number of sold items
-Total sales amount
-List of products ranked by sales amount
-Bar chart of product sales amount
-Brief analysis conclusion
Four, anomaly check
Check for null values, negative numbers, zero values,
data types, and suspected duplicate records.
Anomalies found are only marked, not automatically deleted.
Formatting requirements:
1.Clear table headers.
2.Amount uses RMB format.
3.Numeric columns are right-aligned.
4.Column width fits the content.
5.Freeze the header.
6.Enable filtering for details.
7.Formulas retain editability.
8.Charts use real data sources.
9.Do not convert tables into images.
Output requirements:
-Create a real XLSX file.
-Do not overwrite the original file.
-Can be opened with Excel or WPS.
-Check the formulas and summary results.
-Finally provide the file download link.
The correct total sales amount should be 490 RMB,
and the total number of sales items should be 9.
If the calculation results are different,
please check the formulas and data before delivery.
This prompt already includes the data, calculation rules, chart requirements, and file format.
If the tool can directly generate XLSX, workbook creation can be completed in one go. If only a standard chat model is used, you may need to manually copy the generated tables and formulas into Excel to save them.
X. Complete Example: One Prompt for Excel Analysis
The previous operations were broken down into several stages: data inspection, summary calculation, chart creation, and file export.
If you are already familiar with the operations, you can use the complete prompt below directly.
Example: Complete Prompt for AI Excel Data Analysis
possessing both Excel spreadsheet creation and data analysis capabilities.
Please analyze the following sales details,
Create a complete sales analysis Excel.
I. Raw Data
Date,Product,Quantity,Unit Price
Monday,Laptop,2,30
Tuesday,Mouse,3,50
Wednesday,Laptop,1,30
Thursday,Mouse,1,50
Friday,Keyboard,2,100
II. Statistical Rules
1.The quantity represents the number of units sold.
2.Sales amount = Quantity × Unit price.
3.Aggregate sales volume and sales amount by product.
4.Sort by sales amount in descending order.
5.Tie ranking for products with the same sales amount.
6.The currency unit is RMB Yuan.
Do not fabricate:
-Number of orders
-Return quantity
-Profit
-Cost
-Growth rate
-Customer Information
III. Data Validation
Check:
-Null values
-Numeric format error
-Negative numbers and zero values
-Suspected duplicate records
-Abnormal unit price
Data is not automatically deleted.
IV. Statistical Analysis
Calculation:
-Number of product types
-Total number of items sold
-Total sales amount
-Sales volume for each product
-Sales revenue for each product
-Sales revenue ranking
V. Chart Creation
Generate a bar chart of product sales revenue.
Requirements:
-The horizontal axis is the product
-The vertical axis is the sales amount
-Display value labels
-Can be edited in Excel
VI. Generate Excel File
File name:
RUNOOB-Sales Data Analysis.xlsx
Contains four worksheets:
1.Raw Data
2.Product Summary
3.Sales Analysis
4.Anomaly Check
Calculation formulas must be retained.
Data tables cannot be replaced with static images.
VII. Result Verification
The correct result should be:
Sales records: 5 entries
Product types: 3 types
Total units sold: 9 units
Total sales amount: 490 RMB
Keyboard: 200 RMB
Mouse: 200 RMB
Laptop: 90 RMB
Keyboard and mouse sales amount are tied for first place.
Please verify that the formula calculation results match the data above.
After completion, provide the XLSX file,
and briefly explain the core analysis conclusions.
Do not overwrite the original file.
Example of analysis results
Original example screenshot for this lesson:

The final report can include the following content:
Eleven, Advanced: Using Pivot Tables to Analyze Sales Data
When the data volume is large, in addition to using SUMIF and SUMIFS, you can also use Excel's PivotTable.
The advantage of PivotTable is that you can quickly change the statistical dimension by dragging fields, without needing to write a separate formula for each product.
How to create a PivotTable
Select the sales details in Excel, then selectInsert -> PivotTable.
Set up in the field list as follows:
| Area | Insert field |
|---|---|
| Row | Product |
| Value | Quantity (sum) |
| Value | Sales (sum) |
This way, you can get sales data summarized by product.
If you are not familiar with the operation, you can also ask the AI to explain which positions to click, or ask an Agent that supports Excel operations to assist with creation.
Example: Create a Pivot Table
create a product sales data pivot table.
Requirements:
1.The row field should be product name.
2.Sum the quantity used.
3.Sum the sales amount.
4.Sort by sales amount from high to low.
5.Display the total.
6.Retain original data.
7.Do not change existing statistical metrics.
If the current environment cannot directly create
native Excel PivotTables,
please specify,
and provide manual creation steps.
Note that a summary table using standard formulas is not equivalent to a native Excel PivotTable. If the task requires delivering a refreshable, draggable field PivotTable, you must confirm that a PivotTable was actually created in the file.
Twelve. Advanced: Automatic statistics update after adding sales records
In real-world work, sales data increases every day.
If we have to rewrite formulas and remake charts every time a new sales record is added, then the meaning of automation is lost.
Therefore, when creating the Excel for the first time, you can require the AI to use an easily extensible data structure.
For example, append to the original data:
| Date | Product | Quantity | Unit price |
|---|---|---|---|
| Saturday | Mouse | 2 | 50 |
The new sales amount is 100 yuan, so the total sales amount changes from 490 yuan to 590 yuan, and the total sales volume changes from 9 items to 11 items.
The new product summary is:
| Product | Sales (units) | Sales amount (CNY) |
|---|---|---|
| Mouse | 6 | 300 |
| Keyboard | 2 | 200 |
| Notebook | 3 | 90 |
| Total | 11 | 590 |
Instance: Add data and update report
Append the following sales records:
Saturday, Mouse, 2, 50
Requirements:
1.Do not modify the original five sales records.
2.Append the new records to the end of the detail table.
3.Update product sales summary.
4.Recalculate total sales volume and total sales amount.
5.Update sales ranking.
6.Update product sales bar chart.
7.Retain existing formula and table styles.
Expected results:
Total sales: 11 items
Total revenue: 590 RMB
Mouse revenue: 300 RMB
Please generate a new XLSX version,
Do not overwrite the original file.
List the changed statistical results after completion.
If the original details use an Excel spreadsheet and the summary formula uses structured references, new data will be easier to automatically include in statistics.
If you are using a pivot table, you may still need to refresh after the source data changes.
XIII. Frequently Asked Questions and Solutions
| Problem | Possible Cause | Solution |
|---|---|---|
| Sales amount calculation error | Calculation error when AI directly generates numbers | Recalculate and verify using Excel formulas |
| Amount cannot be summed | Amount is saved as text | Convert to numeric and display using cell currency format |
| Confusion between sales volume and order count | Statistical scope is not explained | Clarify the difference between quantity, record count, and order count |
| Aggregated results are too large | Duplicate records or incorrect statistical range | Check duplicate rules and formula reference ranges |
| Chart does not update after adding new data | Chart references a fixed data range | Check data source range, use dynamic tables or update summary |
| Formula displays an error | Cell format, reference, or software compatibility issue | Check formula and range, confirm calculation settings |
| Only generated table text | AI did not actually create an XLSX file | Use a tool that supports workbook generation and explicitly deliver the format |
| Pivot tables cannot be refreshed | Generated is a standard summary table, not a native PivotTable | Create a real PivotTable and check the data source |
General Excel result checking prompt
If the generated file has issues, it can be given to an AI that supports Excel analysis for rechecking.
Example: Check Excel workbook
Items to check:
1.Whether the worksheet is complete.
2.Whether the original data has been modified.
3.Whether quantity and unit price are numeric types.
4.Whether the sales amount formula is correct.
5.Whether the product summary is complete.
6.Whether the total sales volume and total sales amount are accurate.
7.Are there any incorrect rankings.
8.Does the chart reference the correct data.
9.Are there any null or abnormal records.
10.Are there any formula errors or incorrect references.
Please output the list of issues first.
For questions that can be confirmed,
provide correction suggestions.
Do not delete the original data arbitrarily.
Do not overwrite the original file.
After confirming the scope of modification,
generate the corrected XLSX file.
Fourteen, Hands-on Practice
Exercise 1: Append a sales record
Add "Saturday, mouse, 2 items, unit price 50 RMB" to the original five data points.
Recalculate product sales volume, sales amount, and ranking, and check if the final total sales amount is 590 RMB.
Exercise Two: Create a product sales chart
Have the AI generate a sales amount bar chart and insert it into the Excel workbook.
Require that the chart title, product name, and amount labels are clear and can adjust according to the data.
Exercise Three: Simulate abnormal sales data
Add a record with a unit price of 0 to a copy of the exercise file, and then have the AI check for anomalies.
Require that only this record be flagged and the possible reason be stated, without direct deletion or assuming it is an incorrect order without verification.
Exercise Four: Generate a Complete Sales Weekly Report
Have the AI write a sales weekly report of under 200 words based on the product summary table.
The report should include total sales, total volume, best-performing products, and issues that need attention; do not fabricate profit or growth rates.