For working or educational purposes, people use pie charts a lot. Pie charts help a user or viewer to understand statistical data easily. In this article, we will show you how to make a pie chart in Excel with one column of data.
How to Make a Pie Chart in Excel with One Column of Data: 2 Handy Ways
In Excel, pie charts help users analyze data. Sometimes, users need to make a pie chart from one column of data. In this article, you will see two easy ways to make a pie chart in Excel with one column of data. In the first approach, we will insert a PivotTable to make the pie chart, and in the second method, you will see the usage of Visual Basic Applications (VBA) to do the same. We will use the following data set for both the procedure.
1. Inserting PivotTable to Make a Pie Chart in Excel
In this method, we will insert a PivotTable to make the pie chart in Excel with one column of data. The steps for this method are as follows.
- First of all, highlight the entire column of your data.
- For the following example, that is (B4:B14).
- Then, go to the Insert tab of the ribbon and choose PivotTable.
- After selecting, you will see that in the “Select a table or range” drop-down box the entire column of our data (B4:B14) is present.
- Then, select “Existing Worksheet” and choose an empty cell near your data set.
- For example, we will use cell D4 for this purpose.
- After that, click OK.
- After clicking OK, a task pane named “PivotTable Fields” will appear.
- From there, drag Sales in June 2022 to both Rows and Values at the bottom of the pane like the following picture.
- Finally, you will see a newly inserted PivotTable next to your data set.
- In the next step, after creating the PivotTable, select any cell from the table.
- Then, go to the Insert tab from the ribbon and click on “Insert Pie or Doughnut Chart” from the Charts.
- After that, you will see different pie models for the data sets. Select as per your choice.
- For example, we will choose the Pie option under 2-D Pie.
- Finally, you will be able to make a pie chart with one column of data by following this method.
2. Applying VBA to Make a Pie Chart in Excel
Apart from inserting PivotTable, you can also apply VBA Codes to make a pie chart in Excel with one column of data. This procedure requires coding to make the pie chart. You can follow the steps below to get familiar with this method.
- First, we will use the following data set with one column for our working purpose.
- Then, to apply VBA, go to the Developer tab in the ribbon and choose Visual Basic.
- After that, a new tab will open.
- Then, from the Insert tab choose Module.
- Fourthly, in the Module, paste the following VBA Codes.
Sub Make_a_Pie_chart() Dim Sales_in_June As Chart Set Sales_in_June = Charts.Add Sales_in_June.SetSourceData Source:=Worksheets("VBA").Range("B4").CurrentRegion, PlotBy:=xlColumns Sales_in_June.ChartType = xlPie End Sub
- Then, save the program and press the play button to run the code.
- Finally, you will be able to see the pie chart that has been created through this VBA Code.
- While making the pie chart from the PivotTable give the correct table and worksheet reference. Otherwise, you will not get the output.
- Be careful while copying or writing the code for VBA. If any of the signs from the code change randomly, then the code will not run.
Download Practice Workbook
That’s the end of this article. I hope you find this article helpful. After reading this article, you will be able to make a pie chart in Excel with one column of data by using any of the methods. Please share any further queries or recommendations with us in the comments section below.