Wondering how to make a pie chart in Excel? Keep reading!
In data analysis and presentation, visual representation plays a pivotal role in conveying complex information with clarity. Among many data analysis tools, Microsoft Excel is the leading software.
Therefore, you’ll find many data visualization charts in Excel including 2-D and 3-D pie charts. Join me as I explain different methods to create pie charts using Excel ribbon commands, keyboard shortcuts, PivotTables, Excel VBA, and Office Scripts.
What Is a Pie Chart?
A pie chart is a mathematical circular graph divided into slices to illustrate the numerical proportions of the components being represented by the chart.
Each slice represents a proportionate part of the whole, and the size of each slice corresponds to the quantity it represents.
The entire circle represents 100%, making it an effective visual tool for displaying data distribution and relative sizes of different categories or components within a dataset.
Here’s a common structure of a pie chart:
- Circle: Represents the whole data set.
- Slices: Each slice corresponds to a specific category.
- Arc Length: The angle of each slice is proportional to the percentage it represents.
- Labels: Usually include the category names and sometimes the percentages.
Here are the data visualization properties of a pie chart:
- Parts of a whole: Pie charts are the best objects for data with a limited number of categories that add up to 100% or a whole unit. Each slice of the pie shows the percentage or relative size of one category compared to the total.
- Proportions and comparisons: By looking at the sizes of the slices, you can easily compare the different categories and see which ones are bigger or smaller.
Why Would You Want To Make a Pie Chart
Find below a few major reasons to include pie charts in your Excel data visualization projects:
- A pie chart is beneficial for you when you need to illustrate the distribution of data into different categories. Also, you must present the graphic in a way that a wide range of audience can easily understand the conveyed data.
- If you must effectively show the percentage contribution of each category to the total, a Pie chart is the best option.
- Pie charts also simplify complex data by presenting it in a visually clear and straightforward manner.
- The visual nature of pie charts allows for a rapid visual comparison of the proportions of different categories.
- Pie charts emphasize dominant or significant categories by showcasing them prominently. Therefore, your audience can focus on the key aspects of the data you’re presenting.
- Pie charts are particularly useful when working with smaller datasets and a limited number of categories.
Now that you’ve gained a fundamental understanding of Excel pie charts, explore below various methods to create one in Excel:
Excel Pie Chart Using Insert Chart
- Highlight the data range you want to use for the pie chart. This should include both the category labels and corresponding values.
- Go to the Insert tab on the Excel ribbon.
- Click on the Pie Chart option within the Charts group. You can select from various pie chart subtypes, such as 2-D or 3-D.
- Click on the specific pie chart subtype you want to use, and Excel will automatically generate a basic pie chart on the worksheet.
- Click on the placeholder chart title to add a title relevant to your data. This helps in providing context to the viewer.
- To show data labels, click on the plus (+) sign, click on the Data Labels arrow, and choose Data Callout to show the percentage data visually.
Pie Chart in Excel Using Recommended Charts
Another quick and easy method to add a pie chart is the Recommended Charts tool.
Select your chart content on an Excel worksheet and go to Insert > Charts commands block > Recommended Charts.
The Insert Chart dialog will pop up. Go to the All Charts tab and select Pie on the left side navigation panel. Now, choose the type of pie chart you want and hit OK.
Don’t forget to personalize your chart, like edit the chart title, add data labels, etc.
Pie Chart in Excel Using Quick Analysis
- Highlight the data range in Excel that you want to include in your pie chart.
- Right-click on the selected data to open the context menu.
- Click on the Quick Analysis icon at the bottom right corner of the selected data.
- In the Quick Analysis menu, choose the Charts tab.
- Click on the Pie Chart option in the suggested chart types.
- Excel will generate a basic pie chart, and you can hover over different options to preview their appearance.
- Click anywhere on your worksheet to apply the selected pie chart graphic to your data.
Excel Pie Chart Using Quick Access Tool
Do you need to add pie charts a lot in Excel? Instead of clicking many options, you can add a button in the Quick Access Tool for a pie chart menu. From that, you can easily add different styles of pie charts in Excel.
Adding Pie Chart Menu to QAT
- Open your Excel workbook and locate the Quick Access Toolbar (QAT) at the top-left corner of the Excel window.
- Click on the small downward arrow on the right side of the QAT.
- In the dropdown menu, select More Commands…
- In the Excel Options dialog box, ensure the Insert Tab is selected in the Choose commands from dropdown.
- Scroll down the left-hand menu list and select the Insert Pie or Doughnut Chart option.
- Click the Add >> button to move the Pie Chart command to the right-hand list.
- Use the Up or Down arrows to adjust the position of the Pie Chart command on the QAT if desired.
- Click OK to save the changes and close the Excel Options dialog box.
You have now added the Pie Chart Menu command to the Quick Access Toolbar. It’ll allow for quick access to creating different styles of pie charts with a single click.
Using a Pie Chart From QAT
Highlight the pie chart’s input data on your Excel worksheet.
Click on the Insert Pie or Doughnut Chart menu near the QAT panel above the Excel ribbon menu.
Choose the chart type from 2-D Pie and 3-D Pie in the drop-down menu to insert your chart.
You can now customize the chart as needed.
Pie Chart in Excel Using a Keyboard Shortcut
Find below a hotkey to add a default graph from selected data in Excel and change that to a pie chart:
- Highlight the input dataset and hit Alt + F1.
- Excel will add a basic column chart to your worksheet.
- Click on the Change Chart Type command in the Type block.
- Navigate to the All Charts tab and select Pie on the left-side navigation panel.
- Choose a 2-D or 3-D pie chart from the menu.
- Click OK to insert the object into your worksheet.
Excel Pie Chart Using a PivotTable
Suppose you’re on a PivotTable and want to further visualize the data using a simple pie chart. Here are the steps you can follow:
- Select a cell on the PivotTable that represents the sum of numbers in your dataset.
- In this example, it’s the Sum of Quantity.
- Go to the Insert tab.
- Find and click on the PivotChart command inside the Charts commands block.
- The Insert Chart dialog will open with the All Charts as the selected tab.
- There, click on the Pie option in the left-side panel.
- Choose the pie chart style on the right-side panel.
- Click OK to finalize the chart type.
That’s it! You’ve added an interactive PivotChart, which is a pie chart using your PivotTable in Excel.
Excel Pie Chart Using VBA
I’m showing below step-by-step how you can create an Excel VBA macro to create a pie chart using any data of your choice.
Open your worksheet and press Alt + F11 to show the Excel VBA Editor. There, click the Insert button and choose Module. In the blank module, copy and paste the following script.
Sub Create2DPie()
' Declare variables
Dim dataRange As Range
Dim chartTitle As String
Dim showDataLabels As Boolean
Dim chartObject As ChartObject
' Prompt user for data range
On Error Resume Next
Set dataRange = Application.InputBox("Select the data range for the pie chart", Type:=8)
On Error GoTo 0
' Check if user canceled the input box
If dataRange Is Nothing Then
MsgBox "Operation canceled. No data range selected.", vbExclamation
Exit Sub
End If
' Prompt user for chart title
chartTitle = InputBox("Enter chart title (leave blank for no title)", "Chart Title")
' Prompt user for data labels
showDataLabels = MsgBox("Do you want to show data labels?", vbYesNo + vbQuestion, "Data Labels")
' Create a new chart object on the active worksheet
Set chartObject = ActiveSheet.ChartObjects.Add(Left:=100, Width:=375, Top:=75, Height:=225)
chartObject.Chart.ChartType = xlPie
chartObject.Chart.SetSourceData dataRange
' Set chart title
If chartTitle <> "" Then
chartObject.Chart.HasTitle = True
chartObject.Chart.ChartTitle.Text = chartTitle
End If
' Show data labels
chartObject.Chart.SeriesCollection(1).HasDataLabels = showDataLabels
' Show a message to the user
MsgBox "2D Pie chart created successfully!", vbInformation
End Sub
Click the Save button. On the Microsoft Excel dialog, click the Go back button.
The Save As dialog will open. There, click on the Save as type drop-down menu and choose the Excel Macro-Enabled Workbook (XLSM) option. Click Save to finalize the file type.
Now, you can close the Excel VBA Editor.
Press the Alt + F8 keys together to launch the Excel Macro dialog. There, select the Create2DPie macro and hit the Run button.
Firstly, you’ll see the Input data range dialog. Use your mouse to choose the data range on your worksheet.
Secondly, the Chart Title dialog will show. Type a chart title of your choice.
Thirdly, the Data Labels dialog will pop up. Click Yes if you want data labels.
That’s it! Excel will place the pie chart near your data range on the selected worksheet.
Pie Chart in Excel Using Office Scripts
If you want to further automate your work on Excel using other Microsoft 365 apps like Power Automate, you can use Office Scripts.
It’ll only be available to you if you’re using Microsoft 365 Business Standard or a better subscription to Microsoft Excel. Also, if you’re using Excel provided by a business, the organization admin must enable the Office Scripts feature for your account.
If you see the Automate tab on your Excel desktop or web app, follow these steps:
- Go to the Automate tab and click on the New Script button.
- The Code Editor will show up and there you must copy and paste the following script:
function main(workbook: ExcelScript.Workbook) {
let chart = workbook.getWorksheet("Sheet1").addChart(ExcelScript.ChartType.pie,
workbook.getWorksheet("Sheet1").getRange("A1:B8"),
ExcelScript.ChartSeriesBy.columns
);
}
- Click the Save script button.
- Now, hit the Run button to create your pie chart.
In the above code, simply replace the "A1:B8"
cell range with your own dataset’s range and "Sheet1"
with the actual worksheet name to personalize the script.
Conclusions
You must know how to create various mathematical charts in Excel if you want to become an expert data analyst or data scientist. Today, you learned how to make a pie chart in Excel using a diverse range of methods that suit different Excel expertise levels and project requirements.
If you’re an entry-level Excel user, you should benefit from the Insert Chart and Recommended Chart-based methods.
Need to quickly create a pie chart in front of the audience? You can use the methods based on the Quick Analysis menu, Quick Access Tool, and the keyboard shortcut.
Finally, if you’re an advanced-level Excel user, you might want to practice methods like PivotTable, Excel VBA (for automation), and Office Scripts (for advanced automation).
Did the article help? Do you know a better method to create a pie chart than the ones I mentioned above? Write your feedback and thoughts below.
0 Comments