Sub topic 8
Building a pie chart
This chapter assumes you can select a range, insert a chart from the ribbon, and tell series from categories. A pie chart answers one question: how much of a whole does each part make up? It works only when the parts add up to a meaningful total.
When a pie chart fits
A pie chart plots a single series. Each category becomes a slice, and the slice angle is proportional to its value divided by the total. Because it uses one series, a pie chart ignores any second value column you select.
Use a pie chart when all of these are true:
- You have one series of values.
- Every value is positive. Excel cannot draw a negative slice.
- The categories are parts of one whole, such as regions that make up total sales.
- There are about five or fewer categories.
If you need to compare exact sizes, or you have many categories, a column or bar chart is easier to read.
Build it from the sample range
Use the same range as the column chart:
Region Sales
North 120
South 95
East 140
West 80- Select A1:B5, including the header row.
- Go to Insert, open the Pie or Doughnut menu, and choose 2-D Pie.
- Excel places the chart on the sheet. The Region column becomes the slice labels, and Sales becomes the series.
The total here is 435. East is 140 of 435, so its slice covers about 32% of the circle.
Add data labels
A pie has no axis, so readers rely on labels to read values. Select the chart, choose the Chart Elements button (the plus sign), and tick Data Labels. Then open the arrow beside it and choose More Options. In the Format Data Labels pane you can show:
- Category name, so you can drop the legend.
- Value, the raw sales number.
- Percentage, each slice's share of the total.
Showing the category name and percentage together usually reads better than a legend, because the reader does not have to match colors.
Build it with VBA
The macro below builds the same chart. Compared with the column chart macro, only the chart type changes, and it adds data labels.
Sub CreatePieChart()
Dim co As ChartObject
Set co = ActiveSheet.ChartObjects.Add(Left:=100, Top:=320, Width:=300, Height:=250)
With co.Chart
.SetSourceData Source:=ActiveSheet.Range("A1:B5")
.ChartType = xlPie
.HasTitle = True
.ChartTitle.Text = "Share of Sales by Region"
.ApplyDataLabels
End With
End SubCommon problems
| Symptom | Cause | Fix |
|---|---|---|
| Only one column is drawn | Pie charts plot one series | Select only the category and one value column |
| A slice is missing or wrong | A value is negative, zero, or blank | Check the source cells and correct the data |
| Slices are hard to compare | Too many categories | Group small ones into "Other" or use a bar chart |
| Percentages do not add to 100 | Label rounding | Show one decimal place in the label number format |
Exercise
Your range has columns Region, Sales 2024, and Sales 2025. You select all three columns and insert a pie chart. What does Excel plot, and how should you fix it if you want to show each region's share of 2025 sales?
Show answer
Excel plots only the first value series, Sales 2024, because a pie chart shows one series. To chart 2025, select only the Region and Sales 2025 columns (hold Ctrl to select non-adjacent columns), or use Select Data to make Sales 2025 the series. Then add percentage data labels so each slice shows its share of the total.