如何在 Excel 中制作图表(柱形图、折线图、饼图)

先做汇总再绘图,不要直接画每一笔交易,也不要把总计行选进数据。分类比较用柱形图,时间序列用折线图,饼图只适合很少的几个份额。Excel 在“插入”中选推荐图表或柱形、折线、饼图;Google Sheets 用“插入 > 图表”,在设置中选择类型。

本文目录

快速解答

先做汇总再绘图,不要直接画每一笔交易,也不要把总计行选进数据。分类比较用柱形图,时间序列用折线图,饼图只适合很少的几个份额。Excel 在“插入”中选推荐图表或柱形、折线、饼图;Google Sheets 用“插入 > 图表”,在设置中选择类型。

=SUMIFS(F2:F9,B2:B9,"East")
=SUMIFS(F2:F9,B2:B9,"West")
=SUMIFS(F2:F9,D2:D9,"Widget")
=SUMIFS(F2:F9,D2:D9,"Bolt")
=SUMIFS(F2:F9,A2:A9,">="&DATE(2024,1,1),A2:A9,"<="&DATE(2024,1,31))

检查要点

同一份八行销售在 2026 年 11 月 12 日用 SUMIFS 得到:东区 9450、西区 15000、Widget 19800、Bolt 4650;1 至 4 月为 7800、5400、8850、2400,并与透视表一致。Widget 占比 0.8098159509202454。折线图的月份列必须是真正的日期,本例 =ISDATE(A2) 为 TRUE;文本日期会导致轴顺序错乱或显示序列号。

边界与兼容性

标题应写明指标和期间,不要留下默认的 Chart Title。四月在样本中只有一笔,不宜当成趋势。系列量纲不同时不要挤在同一轴上。图表应链接到可核对的汇总表,而不是在图上手工改点。

完整英文示例、公式与作者备注

Tested in: The monthly and category totals below were calculated in Google Sheets on 12 November 2026 with SUMIFS, and they matched a Region-by-Product pivot of the same eight sales. Excel 365 menu names are the current desktop labels; I did not click through the chart gallery in Excel this session.

Pick the chart after you pick the question

A column chart is the default for comparing a handful of categories: East vs West, or four months of revenue. A line chart is for a sequence, usually time. A pie chart is only for a share of one total, and only when there are a few slices you can actually see.

The source for all three examples is the same eight-row sales list used in How to Create a Pivot Table in Excel: Date, Region, Rep, Product, Units, Revenue, from 8 January 2024 through 9 April 2024. Grand total revenue is 24450. Chart the summaries, not every sale plus that grand total in the same series — the total bar will dwarf the rest and count the same money twice in a pie.

A summary you can trust

These SUMIFS results were evaluated in Google Sheets on 12 November 2026, and the category figures matched GETPIVOTDATA on a pivot of the same data:

=SUMIFS(F2:F9,B2:B9,"East")
=SUMIFS(F2:F9,B2:B9,"West")
=SUMIFS(F2:F9,D2:D9,"Widget")
=SUMIFS(F2:F9,D2:D9,"Bolt")
=SUMIFS(F2:F9,A2:A9,">="&DATE(2024,1,1),A2:A9,"<="&DATE(2024,1,31))
SummaryResult
East9450
West15000
Widget19800
Bolt4650
January7800
February5400
March8850
April2400

Widget’s share of the 24450 total is 0.8098159509202454; Maya Chen’s share is 0.5153374233128835. A pie can show Widget vs Bolt. It is a poor place to show eight individual sales.

For a month axis, put one row per month in its own range, for example H1:I5:

HI
1MonthRevenue
22024-01-017800
32024-02-015400
42024-03-018850
52024-04-012400

The dates in column H should be real dates (the first of the month is enough). If they are text, the line chart will treat them as labels in whatever order the rows happen to be, and Excel may display a serial number such as 45299. See dates stored as text if =ISDATE(H2) is not TRUE. On the original sample, =ISDATE(A2) returned TRUE.

A pivot table is a convenient way to produce that month or region summary. If you chart a pivot directly, leave Grand Total out of the selection, and be aware that refreshing the pivot can change the range the chart points at.

Column chart: compare categories

In Excel 365

  1. Type a two-column summary, such as Region and Revenue: East 9450, West 15000, with headers in the first row. Do not add a Grand Total row.
  2. Select the block, including headers.
  3. Open Insert > Insert Column or Bar Chart > Clustered Column, or start from Recommended Charts and pick a column that uses Region as the category axis.
  4. Click the default title and replace it with something like “Revenue by region, Jan–Apr 2024.”
  5. If Excel plotted the regions as series and the revenue as a single category, switch rows and columns (Chart Design > Switch Row/Column).

In Google Sheets

  1. Select the same two-column block.
  2. Open Insert > Chart.
  3. In the chart editor, set Chart type to Column chart.
  4. Confirm that the header row is used as headers, and that Region is the X-axis.
  5. Under Customize > Chart & axis titles, set a real title. The default “Revenue vs. Region” is easy to leave by accident.

Two columns is all this example needs. A clustered column chart earns its keep when you have two series, such as Units and Revenue, or East and West by month. Keep the units comparable; plotting dollars and unit counts on the same axis makes the units disappear.

Line chart: values over time

Select the month-and-revenue range (H1:I5 in the example), then Insert > Line Chart > Line with Markers in Excel, or Insert > Chart and Line chart in Sheets.

March (8850) is the high month in this sample, February (5400) the low one, and April (2400) is a drop — but April has only one sale in the eight-row list, so I would not treat that last point as a trend. A line chart of four months is fine for showing the method; it is not a forecast.

If the horizontal axis comes out as 1, 2, 3, 4 instead of Jan–Apr, the month column was probably omitted from the selection, or the dates were stored as text. Include the header and the date column, and format the axis as a date (Excel: right-click the axis > Format Axis; Sheets: Customize > Horizontal axis).

Do not connect two unrelated series just because they both go down the sheet. A line chart implies sequence.

Pie chart: a few parts of one whole

Select Product and Revenue: Widget 19800, Bolt 4650. In Excel, Insert > Pie Chart > 2-D Pie. In Sheets, Insert > Chart and set the type to Pie chart. Title it as a share, for example “Share of revenue by product, Jan–Apr 2024.”

That is a reasonable pie: two slices, one of them about 81% of the total. Add Region, Rep, and Product all at once and you get a pile of narrow slices that a column chart would explain more clearly. Never include the Grand Total as a slice.

If you need to show both share and change over time, use a column or line chart of the monthly figures, not a pie for each month.

Titles, totals, and the usual snags

The built-in “Chart Title” is not a title. Name the metric and the period. If the source is in thousands, say so on the axis. A data table under the chart is optional; the summary range on the sheet already is that table, and it is easier to check against SUMIFS.

The most common mistake is selecting the detail list (all eight sales) when you meant to select the two-row region summary, or including Grand Total so a column chart has a third bar at 24450. Another is building the chart, then inserting a row in the source and wondering why the new month is missing — edit the chart data range, or chart a Table / a pivot that you refresh.

Secondary axes help when two series have different scales, but they also hide how unlike the series are. Use one only when you are prepared to label both axes clearly. Combo charts (column plus line) are under Insert > Combo Chart in Excel and under chart type in Sheets; they do not fix a messy source range.

If you color bars to flag a weak month, do it on purpose and say so, rather than relying on the default palette. Conditional formatting belongs on the summary cells, not as a substitute for a chart you can print.

Once the chart is linked to a clean summary, keep the summary next to it. When a number looks wrong, you can go back to the SUMIFS (or the pivot) instead of editing a point on the chart by hand.

Oscar

专注电子表格公式与排错;具体测试环境和待验证事项见各篇文章。

Tested in Google Sheets (via Sheets API) on 12 November 2026: monthly and category totals for the eight-row sales sample were computed with SUMIFS and checked against a Region-by-Product pivot. I did not insert a chart through the Excel UI this session; Excel 365 menu names are the current desktop labels..

本主题下一篇:查找与条件求和 如何去掉 Excel 数据透视表中的空白项