Pivot Table In Excel

What Is Pivot Table In Excel?

Pivot Table in Excel is a tool that allows users to swiftly summarize, analyze and create consolidated summary reports from huge data sets with just a few clicks. It also provides interactivity with the slicers feature.

Pivot Table options help design user-friendly reports, summarizing data in categorical and sub-categorical ways, applying filters, conditional formatting, slicers, subtotals, aggregates numerical data, etc.

Pivot Table in Excel is designed such that not only experts but also beginners can get a summary of the data with just a few clicks.

For instance, the table below shows a textile company’s sales data.

Pivot Table in Excel Intro

By using Pivot Table, we can create a summary report, as shown below.

Pivot Table in Excel Intro Example

As we can see in the above image, we have created a summary sales report date-wise and region-wise with nice formatting.

Key Takeaways
  • Pivot Table is used to summarize the data from a large data set.
  • Pivot Table uses pivot cache to take a snapshot of the data, thus increasing the size of the workbook.
  • The Excel Table option makes the data range dynamic for a pivot table. So, whenever we add or delete, we just have to press the refresh shortcut keys ALT + A + R + A.
  • Pivot Table helps us to analyze the data with simple drag and drop options. Thus, making it easy to create a consolidated summary of the data.

How To Create A Pivot Table?

Before we create pivot table in excel, we need to consider organizing the data into rows and columns. Hence, we have created the following sample data to demonstrate pivot table examples.

Pivot Table in Excel Basic Example

Before we create pivot table in excel, we need to organize the data.

Whenever we organize the data, we need to keep the below things in mind.

  • Always give meaningful heading to the columns.
  • Do not have blank rows or columns in the entire data set.
  • Make sure no subtotals are present in the data.

Now, we use the below steps to create a pivot table.

Now, we use the below steps to create a pivot table.

  1. Step 1: Select the entire data range, including headers.

    Basic Example.1
    Please Note: Only the selected area will be considered for pivot table calculation purposes.

  2. Step 2: Go to the Insert tab and click on Pivot Table.

    Pivot Table in Excel Basic Example.2

  3. Step 3: The PivotTable from table or range window appears. Here, we can see the range of cells we have selected to create the pivot table.

    Basic Example.3
    Please Note: We can also change or readjust the range of cells per the requirement.

  4. Step 4: Next, we need to choose where to place the pivot table. By default, it will prompt for New Worksheet. If we want the pivot table in the same sheet, we need to choose Existing Worksheet.

    Basic Example.4

  5. Step 5: Click OK. In a few minutes, we will be able to see a new worksheet created separately for the pivot table, as shown in the image below.

    Basic Example.5

Now, let us learn about some of the features of the Pivot Table.

Report Area: In this area, we build our report in the pivot table.

Field Section: These are the fields we use to build reports. These fields are nothing but the columns from the data set that we have selected to create the pivot table.

Layout Area: In this area, we have the following options;

  • Rows: This is the area to be used to summarize the data. For instance, if we want to summarize the data based on Ship Mode then we can drag and drop the Ship Mode to the rows. Once we drag and drop the Ship Mode to the rows section, we can see the summarized Ship Mode values in the report area.
Pivot Table in Excel Basic Example.6
  • Values: In this section, we will do all our calculations. For instance, if we want to include the sales, then we should drag and drop the Sales column to the Values.
Pivot Table in Excel Basic Example.7

Now we can see total sales based on Ship Mode.

  • Columns: After we see the total sales based on Ship Mode, further, we can also drill to another level like Product Category. Drag and drop Product Category to the columns area.
Pivot Table in Excel Basic Example.8

Now we can see total sales based on Ship Mode and Product Category.

  • Filters: Further, we can also add some filters to the report we created under the filters section. For instance, if we want to filter based on Region, then drag and drop the Regions column to the filter area.
Pivot Table in Excel Basic Example.9

Likewise, we can create pivot table in excel by using all the above features.

How To Use Pivot Table?

Now, we know how to create a pivot table using features. Next, we will see how to use the pivot table with the same data. Finally, we will try to answer a few questions to know the usage of the pivot table.

What are the total sales & profit for each Customer Segment?

Step 1: Drag and drop Customer Segment to Rows.

Basic 2.1

Step 2: Now drag and drop the Sales column to the Values section.

Pivot Table in Excel Basic 2.2

Pivot Table has given us the summary of sales based on Customer Segment.

Similarly, drag and drop Profit to the Values section (just below sales) to the Profit summary.

Basic 2.3

Pivot Table gives us the summary of sales & profit for each customer segment.

What are the top 5 States or Province based on sales?

Step 1: Drag and drop the State or Province column to rows and the Sales column to values. It will give us the total sales based on state.

Pivot Table in Excel Basic 3.1

Step 2: By default, the pivot table alphabetically gives the summary and sorts based on State or Province.

Since we are looking for the top 5 states or provinces, right-click on any of the cells in sales values.

Pivot Table in Excel Excel Basic 3.2

Step 3: Go to Sort and choose Sort Largest to Smallest.

Pivot Table in Excel Basic 3.3

It will sort all the numbers in descending order.

Pivot Table in Excel Basic 3.4

Step 4: Click on the State or Province column’s drop-down list and hover the mouse on Value Filters. Then, choose Top 10.

Pivot Table in Excel Basic 3.5

Step 5: In the Top 10 filter (State or Province) window, enter Top and 5.

Pivot Table in Excel Basic 3.6

Click OK. We will get the top 5 States or Province based on sales as shown below.

Pivot Table in Excel Basic 3.7

Examples

Let us look at a few advanced examples of using a pivot table.

Example 1: Find Profit % Using Calculated Field in Pivot Table

For instance, the below table shows State or Province wise total sales and profit values in the pivot table.

Pivot Table in Excel Example 1

We do not have Profit % in the data; however, by using the pivot table, we can calculate on our own with the following steps:

Step 1: Select any of the cells in the pivot table, and click on the Pivot Table Analyze tab.

Pivot Table in Excel Example 1.1

Step 2: Under this tab, click on the Fields, Items, & Sets drop-down and choose Calculated Field.

Pivot Table in Excel Example 1.2

Step 3: Next, the Insert Calculated Field window pops up. Give a name for the newly inserted column.

Pivot Table in Excel Example 1.3

Step 4: In the Formula: box, enter =Profit/Sales, and in the Fields: section, choose Sales as shown in the following image.

Pivot Table in Excel Example 1.4

Step 5: Select OK. We will be able to see a column as shown below.

Pivot Table in Excel Example 1.5

As of now, we see zero as the value. It is due to formatting issues.

Step 6: Select the entire column and apply Percentage Formatting.

Pivot Table in Excel Example 1.6

Likewise, we can create a new calculated column in the pivot table.

Example 2: Grouping Dates in Pivot Table and Number Formatting

Consider the following table showing the sales data of a bakery.

Pivot Table in Excel Example 2

Using this data, we will create a pivot table and understand how to group dates.

Step 1: Select the entire data and press the shortcut keys ALT + D + P + F to insert the pivot table.

Step 2: Drag and drop the Order Date column to rows and the Total Price column to values.

Example 2.1

As we can see, we have sales based on each day; but we need to summarize it by Year and Month.

Step 3: Right-click on any of the Order Date columns cells and choose Group.

Example 2.2

Step 4: The window named Grouping pops up.

Example 2.3

Step 5: Select Years and Months.

Example 2.4

Click OK. We can see that the data has been categorized into Years and Months.

Example 2.5

However, there is another thing we need to do here, i.e., the formatting of numbers.

To apply currency formatting for total price, click on the down arrow under the values section and choose Value Field Settings.

Example 2.6

The formatting window, Value Field Settings pops up. Click on the Number Format option.

Example 2.7

Under Number Format, select Currency and apply the dollar currency format.

Example 2.8

Click OK.

Our pivot table will now have number formatting, as shown below.

Example 2.9

Example 3: Add Slicers

Please Note: Slicers are available only from Excel 2010 version.

To make the pivot table interactive, we can add slicers.

For instance, if we want to make the pivot table interactive for Product, then select any of the cells in the pivot table and choose Pivot Table Analyze.

Example 1.1

Click on the Insert Slicer option.

Example 3

In some time, we can see Insert Slicers window listing all the columns where we can choose the desired column.

In this case, let us choose the Product column.

Pivot Table in Excel Example 3.1

Click OK. We can see a slicer, as highlighted in the image below.

 Example 3.2

From the slicer, we can select any of the products and the pivot table will display a summary for the selected product.

Example 3.3

Refresh A Pivot Table

Pivot Table in excel uses a cache to store the data, and any changes in the source data will not be updated dynamically. So, we need to refresh the data manually. Let us learn how to refresh pivot table in excel using the following example.

For instance, we have added some additional data for the below pivot table.

Refresh Table

Ideally, we should select the Pivot Table Analyze tab to refresh the data and click on the refresh button as shown in the following image.

Refresh Table.1

This refresh happens only when there is a change in the existing range of cells. But, if any additional rows or columns are added, it won’t refresh.

To do this, we need to change the range of cells every time. So, click on Change Source Setting and change the source range manually.

Refresh Table.2
 Refresh Table.3

However, doing this every time makes the task tedious. So, to make refresh dynamic, we need to convert the data range into an Excel Table.

Select the data range and press Ctrl + T to bring the Excel Table option.

Refresh Table.4

Click OK, and data will be converted to Excel Table format.

Refresh Table.5

Give a name to the Excel table.

 Refresh Table.6

Now in the Change PivotTable Data Source window, instead of selecting the table range through the cell, we should give the table name as Sales and click OK.

Refresh Table.7

We just have to click on the Refresh button whenever we make any changes.  Or, we can also press the shortcut keys ALT + A + R + A.

Similarly, we can refresh pivot table in excel.

Move Pivot Table In New Location

We can change the location of the already built Pivot Table.

To change, we need to click on Move Pivot Table under Pivot Table Analyze.

Move Table

The Move PivotTable window pops up.

In this window, we need to choose where we need to move the pivot table.

Move Table.1

If we want to move the pivot table to a new sheet, then choose New Worksheet. To move the pivot table within the same sheet, then choose Existing Worksheet.

Based on our selection, pivot table will be moved to a new location.

Delete A Pivot Table

To delete pivot table in excel, we need to look into below two options.

  • If we have a pivot table in the new worksheet without any other data, then we can delete the entire worksheet.
  • If the worksheet has some other data, then we need to select the pivot table area and then hit the delete key. To select the entire pivot table quickly, go to Select and click on Entire Pivot Table option from the PivotTable Analyze.
 Delete
  • Using this option, we can select the entire pivot table. Then, press the delete key to remove or delete pivot table in excel.

Important Things To Note

  • The Pivot table in excel is one of the earliest functions introduced by excel in 1994.
  • This table is called ‘Pivot’ as it rotates the rows/columns and presents them from various perspectives.
  • Pivot Table uses cache to store the snapshot of the data whenever we create a pivot table in Excel.
  • Slicers feature is available only from Excel 2010 and later versions.
  • The shortcut keys to create a pivot table are ALT + D + P + F.
  • Pivot Table data range should not have any blank columns.

Frequently Asked Questions

Why do we use Pivot Table in Excel?

Pivot Table in Excel is used to summarize and create consolidated reports from huge data.

Where is the Pivot Table tool in Excel?


The Pivot Table in Excel is under the Insert tab in the Tables group.

FAQ 1

How does Pivot Table work in Excel?


Pivot Table in Excel uses Pivot Cache in the backend. Whenever we insert a pivot table, Excel takes the screenshot of the data and stores it in its memory. Hence, it is called Pivot Cache.

Then, pivot table uses this cached data and starts summarizing the data.

How to Create Pivot Table in Excel with Multiple Worksheets?


Usually, we use single data range to create pivot table. However, it is possible to create a pivot table with multiple ranges or worksheets as well.

For instance, we have below 4 region-wise sales data.

FAQ 2

As we can see, we have the same data structure in all the worksheets.

To include all the worksheets in a single pivot table, press the shortcut keys ALT + D + P. In some time, we can see the following window.

FAQ 2.1

Choose Multiple Consolidated Ranges.



Click on Next and then choose the Create a single page field for me option.

FAQ 2.3

Click on Next and choose the range from the first region table.

FAQ 2.4

Click Add.



Add other 3 regions as well.



Once we have added all the 4 regions, click on Next> and choose the New Worksheet option.

FAQ 2.7

Click Finish to insert a pivot table.

FAQ 2.8

Likewise, we can create a pivot table from multiple ranges or worksheets.

Download Template

This article must be helpful to understand the Pivot Table in Excel, with its formula and examples. You can download the template here to use it instantly.

This has been a guide to Pivot Table in Excel. Here we discuss how to create, add, delete, modify and refresh pivot table with examples and downloadable excel template. You can learn more from the following articles – 

Reader Interactions

Leave a Reply

Your email address will not be published.