How to Create a Basic PivotTable in Microsoft Excel
What is a PivotTable?
A PivotTable allows an Excel user to create an dynamic report of data known as a PivotTable report. PivotTables are very effective at taking a vast amount of information and creating a meaningful presentation of that data as an output. Not only can PivotTables show data in multiple views, they can also be programmed with formulas to perform calculations. It's essentially a table that summarizes another table and is very helpful when it comes to making sense out of a large amount of data. A PivotTable consists of columns, rows, values, and filters which are summarized below.
PivotTables take practice but building them is an easy concept. After a PivotTable is inserted, attributes (fields) of the source data are then organized into one or more sections of a PivotTable (columns section, values section, rows section, filters section) to create the table. Each section can be seen in the illustration below.
PivotTable Fields and Sections
The column section in a PivotTable represents the heading area that stretches from left to right along the top of the PivotTable. When data is added to the columns area the unique values relating to those columns can be displayed in the rows area. The column can be used to show a trend over time or a data matrix.
When source data needs to be calculated, counted, summed, or averaged, the values area can be utilized. When using the values area in a PivotTable the values being used are measured.
When data is dragged to the rows section the data displays on the left-hand side of the PivotTable. The Rows area may not have any field added to it but will typically have at least one field.
The filters area is optional for your data. This section allows you to filter the data however you see fit to convey a clear message about the data. The field that is dropped here is data that has focus on it. This data may need to be sorted or narrowed with a filter.
The sample data shown below can be downloaded here if you would like to follow along with this PivotTable creation tutorial. This data set shows international statistical projects being performed around the globe. Columns display ID Number, Name, Country Code, Country, Region, and several more attributes.
PivotTable Sample Data
Creating a Simple PivotTable
To create a PivotTable, you need to have some type of source data. Source data should be data that represents records that have more than one column. If following along, open the spreadsheet in Microsoft Excel from the link above. Be sure to save the spreadsheet before working on it.
Select the insert tab and click on the PivotTable icon in the “Tables” group on the left-side of the ribbon. The Create PivotTable dialog box appears and needs data. If your data is already saved as a table selecting any cell within that table will add the whole table to the Table/Range field. Otherwise, select the complete range of your data for this field.
Next, decide if you want the PivotTable to be shown on a new sheet or on the current worksheet. If you want the PivotTable to show on the current worksheet, you’ll have to select which cell you want the table to start in. Since there is so much data in the example, I would like the PivotTable to have its own worksheet. After you decide, click OK.
Adding Source Data
Know Your Design
At this point, the PivotTable is empty. The next step is to populate the PivotTable using the PivotTable Field Pane. There are two very important questions to ask yourself before creating a PivotTable which are: “What data to I want to display?” and “How to I want to display it?” to determine which fields go where.
My PivotTable Design
For this PivotTable I would like to see the sum of the total loan amount and the project name associated with that value. I would also like to filter out any records that have loan amounts under $10 million dollars and see each value categorized by region in a matrix type format.
First, I will establish a value (loan amount) for the PivotTable. The total loan amount needs to be dragged from the fields list to the value section. This value will appear as a sum. Since each record is unique, there will be no sum. If there were records with the same project name, they would be combined and a sum of the two would be displayed.
Next, the project name needs to be dragged from the fields list to the rows section. You'll notice that the PivotTable side bar disappears after it was edited the first time. To get the side bar to appear again right click on any header in the PivotTable and select "View Field Settings." The illustration below shows what the PivotTable should look like after adding the project name to rows.
Next, I would like to filter out any loan amounts under $100 million dollars. To do this I will need to drag the loan amount field to the filters section of the PivotTable. As a result, a filter is added to the PivotTable for that field. When I click on the drop down that is located on the new header "Row Labels," I must choose the option "Value Filters," then click on greater than or equal to. See the operation in the illustration below.
The values filter requires a value that will filter out any values below it. Since I need to display $100 million in loans and above, I will added 100 to the field.
The PivotTable below shows the data after being filtered.
Now that I have only the high value loans of $100 million and more, I'd like to show each value by region. The goal is to create a matrix that will categorize each loan value by region. To do this the regions field value needs to be added to the columns section. The resulting table is shown below.
Insert a Graphical Representation of the PivotTable
Sometimes having a graph of the PivotTable will help you compare categorized data and high and low values. We will see both after graphing this PivotTable. To insert a chart, click on Analyze located under the PivotTable Tool section of the ribbon. Now find and click on the insert Pivot Chart button.
Choosing the Right Chart
Based on the type of data in the chart Excel will decide what type of chart will be available for your PivotTable. In this case I can only select between bar charts and pie charts. The best visual representation of this data would come in the form of a clustered bar chart.
Clustered Bar Chart
This PivotTable could have been displayed dozens of different ways. Depending on your goals for reporting the data, the table will need to be structured differently. In most cases with a PivotTable, some trial and error will be involved in the design of the table. To get good practice at these tables it’s best to try to come up with as many different table styles as you can to get a feel for the PivotTable function.
To get a better understanding of how PivotTables work in Excel I recommend the following book. I have been using the Excel Bible for years to improve my understanding of all aspects of this Microsoft product.
The Excel 2019 Bible
This content is accurate and true to the best of the author’s knowledge and is not meant to substitute for formal and individualized advice from a qualified professional.
Questions & Answers
© 2018 Joshua Crowder