×

Pivots Table in Excel

What is a Pivot?

A pivot table is a tool to create summary reports from data-sets irrespective of their sizes but is helpful even if the data is more than just 20 rows!

Apart from creating summary reports (counting, summing observations for a variable like a salary or diesel consumption at a pump, etc..), it can be used to analyze data – by selecting various combinations of different variables, you can see how your data changes thus making strategies accordingly.

For example: In fraud, we may have millions of customers leading to millions of data, but the fraudsters may just be a few hundred. Using Pivot tables, we can identify the common attributes of fraudsters, thus targeting them without impacting the genuine customers.

Pivot Table Structure

The below are lists down all the columns we have in the dataset for which the Pivot table was inserted. Currently, we have 3 columns in our dataset – Name, Age and Salary

Pivots Table in Excel

The four pivot table data fields are given below:

Filters: In Filters, we will drag and drop those variables from the above list on which we want to apply a filter.

Columns: In Columns, we will drag and drop that variable for which we want its different values to appear in different columns

Rows: In Rows, we will drag and drop that variable for which we want its different values to appear in different rows.

Values: In Values, we will drag and drop those variables for which we want to summarize the data.

Pivots Table in Excel

How to create a Pivot table?

There are two ways to create a Pivot Table –

Using Toolbar Method –

  1. Go to Insert Tab and click on ‘PivotTable’.
Pivots Table in Excel
  • Excel will prompt you to give the data range for which you want to insert a pivot.
Pivots Table in Excel
  • Once you have given the data-range, it is then up to you whether you want to create the Pivot on the same worksheet or a new sheet – clicking on ‘New Worksheet’ will create the pivot table on the new worksheet and clicking on ‘Existing Worksheet’ will create the pivot table on the current sheet at the location (cell address) you specify by just clicking on the cell.
Pivots Table in Excel

Not using Toolbar –

  • Select the dataset for which you want to insert the pivot table
    • And using your keyboard press the following keys Alt key, D, P and P again (Alt + D + P + P)
    • A pop-up will appear for Pivot Table in which your dataset range would already be present
    • Now you just need to specify the place where you want to insert the pivot table i.e. a ‘New Worksheet’ or on the ‘Existing Worksheet’.

Once either of the above steps has been completed, and you click on ‘Finish’ (and if you had selected on ‘New Worksheet’ which most find more convenient to use), you will get the following format on a new sheet.

Pivots Table in Excel

Formatting in a Pivot Table

The salary figures in the above pivot table need formatting – we will use the following steps –

  • Go to the values field in the pivot table and click on the black arrow head pointing downwards
  • A pop-up menu as shown below will appear – click on ‘Value Field Settings’
Pivots Table in Excel
  • Once you have clicked on ‘Value Field Settings’, another pop-up menu will appear which will look like below –
Pivots Table in Excel
  • Before discussing ‘Custom Name’ field, let’s look at ‘Summarize Values By’ – since over here we are summing the salary variable (for numerical values, by default excel will sum the numbers and not count them) – ‘Sum’ has been highlighted, if you want to ‘COUNT’ and not ‘SUM’, you can select ‘Count’ and pivot table will then give you the count
  • Now assuming, we just want salary sum here, to change the format, we will click on ‘Number Format’ and a familiar window (shown below) will appear. You can now change the format to ‘Currency’ and add a $ (dollar) sign and click on ‘OK’
Pivots Table in Excel
  • Once you have clicked ‘OK’, if you want you can change the ‘Custom Name’ field to something you like – do note that you cannot use an already existing column name. I have changed the name to ‘Salary Sum’ and then click on ‘OK’
Pivots Table in Excel

The data will appear as  shown in the image below. You will notice that the cell A4 is displayed as ‘Salary Sum’ and not as ‘Sum of Salary’. Also, there is a $ (dollar) symbol for salary figures.

Pivots Table in Excel

Slicer

The slicer feature in Microsoft Excel provides visual filters or interactive buttons that display the items that have been chosen within a Pivot Table. In this section, we will check the way by which you can apply filters in a pivot with the help of Excel’s Slicer feature –

  • Click anywhere on the Pivot.
  • Now go to ‘Analyze’ conceptual bar in the toolbar.
  • Now click on ‘Insert Slicer’.
Pivots Table in Excel
  • A prompt will appear asking for which columns you want to insert the slicer for – select all the column and click on ‘OK’
Pivots Table in Excel
  • Here, we have inserted Slicer for 3 columns, ‘Portfolios worked on’, ‘Gender’ and ‘Region’ – as you keep on selecting items in any of these slicers, your Pivot table will keep on getting updated based on these filter values.
  • To select multiple values together, click on the ‘Multi-Select’ option, and then you can select multiple values together.
Pivots Table in Excel
  • To remove filters, click on the icon on the top right and all the filters will be removed
Pivots Table in Excel

Calculated Fields in the Pivot Table

To add calculated fields to the pivot, you will need to –

  1. Click on the Pivot Table
  2. Click on the ‘Analyze’ bar appearing in the toolbar.
Pivots Table in Excel
  • In the ‘Calculations’ section, click on ‘Fields, Items & Sets’ and then click on ‘Calculated Field’
Pivots Table in Excel
  • On clicking on ‘Calculated Field’, a pop-up will appear as shown below –
Pivots Table in Excel
  • Now let’s suppose I want the average amount of salary being given to an age group based on successful cases completed by the employees in that age group –
  • We will click on ‘Calculated Field’
  • In the ‘Name’ section, we will mention the name as ‘Avg Commission per Case’
  • In the Fields section, because we want to find the average salary per successful case, we will first click on ‘Salary’ field and click on ‘Insert Field’
Pivots Table in Excel
  • Then in the Formula section, we will manually add a slash used for division ‘/’
Pivots Table in Excel
  • And then click on ‘Successful Cases’ and click on ‘Insert Field’ and then click on ‘Add’ and then ‘OK’

A new variable will be created in the Pivot table showing the average commission per successful case – you can then change the format or the name of this field as shown in earlier sections

If you want to add a new calculated field, you can go to the sheet which consists of data and add a new column there using formulas.

If you add a new column after the last column, then to ensure that the new column appears in the pivot table, you will –

  • Click anywhere on the pivot table
  • Go to ‘Analyze’ tab
  • Click on ‘Change Data Source’ – clicking on it, excel will take you to the sheet which consists of the data
  • Update the range and click on OK
  • And then click on ‘Refresh’ next to ‘Change Data Source’ option and the new column will start appearing in the ‘PivotTable Fields’

If you add a new column between existing columns, you will just need to click on ‘Refresh’ and the new column will start appearing in the ‘PivotTable Fields’


Related Topics

What do you understand by Combination Chart in Microsoft Excel?

In Microsoft Excel, an individual has the Combo Chart option available, which can be effectively clubbed into two charts types, which are Column Clusters Chart, Line Chart to get the...

7 minutes read.

Conditional Formatting in Excel

Conditional Formatting What are the conditional formats? Conditional Formatting is a tool that allows the user to format cells or range of cells based on the selected condition or given criteria. The formatting will...

4 minutes read.

Multiplication in Excel

Multiplication plays a vital role in Mathematics. Usually, the calculations are performed manually and automatically. Manual calculations take time and sometimes leads to error, and it is a challenging process...

5 minutes read.

Excel MATCH () Function

Excel MATCH () Function The MATCH () function in excel locates the position of a lookup value in a row, column, or table and returns the relative position of an item in an array. Syntax MATCH...

2 minutes read.

Custom Sort Order in Excel

Microsoft Excel Worksheet is widely used for office, personal and various usages. The data present in the worksheet is a combination of numbers and alphabets. If the worksheet contains more...

3 minutes read.

Insert Row in Excel

It was known that we have various multiple ways that are extremely helpful in inserting a particular row in the Microsoft Excel. And we have lots of shortcut options available...

6 minutes read.

Excel Nested IF’s Function

Excel Nested IF’s Function This function in excel helps in checking multiple conditions together by using IF conditions within the IF condition. Syntax if(Logical_Test, [value_if_true], if(Logical_Test, [value_if_true] , [value_if_false])) Parameter Logical_Test (required)- This parameter represents the condition which...

2 minutes read.

Check Marks in Excel

What is a Check Mark? Among various characters checkmark is one of the characters used to indicate that the item or product in the list is correct, chosen or selected. A...

5 minutes read.

How to make use of the Excel Autofit in Excel

In Microsoft Excel, Autofit can be used to adjust and then fix the column and the respective row height to till the maximum limit until and unless it has the...

7 minutes read.

Excel WEEKNUM() Function

The WEEKNUM() function in excel returns the week number from 1 to 54 of a specific date in a year. The WEEKNUM function starts counting with the week that contains January 1...

1 minute read.

Excel VLOOKUP() Function

Excel VLOOKUP() Function The VLOOKUP() function in excel is used to lookup the value on the leftmost side of the table and then return the value in the corresponding row basis on the supplied...

2 minutes read.

Separate Strings in Excel

How to Separate String in Excel Day by day, Microsoft Excel is increasing for business and personal use. It is a combination of numbers and alphabets based on the data provided....

4 minutes read.

Goal Seek in Excel

Goal Seek in Excel The Goal Seek Excel function in Excel facilitates an automatic solving approach by adjusting a few pointers to reach a required output. Goal seeking is used when you have a value in...

3 minutes read.

Text to Columns

Text to Columns This Excel feature is used to split the cell content name of one cell into multiple columns based on a delimiter, such as a space or a special character or based...

2 minutes read.

Excel SEARCH() Function

The SEARCH() function in excel finds one text value within another. It is the same, unlike FIND() function, with the only difference that it in a case-insensitive function. Syntax SEARCH (find_text, within_text, [start_num]) Parameter...

1 minute read.

Excel IFERROR() Function

The IFERROR() function in excel returns the specified value if initially supplied the argument or formula returns an error, otherwise returns the result of the formula supplied in the first argument. When...

2 minutes read.

Excel EDATE() Function

Excel EDATE() Function The EDATE() function in excel returns the serial number of the date that is the indicated number of months before or after the start date. Syntax EDATE(Start_Date, Month) Parameter Start_Date(required)- This parameter represents...

1 minute read.

Excel LARGE() Function

The LARGE() function in excel returns the k-th largest value in a data set. Syntax LARGE (Array, kth small number from the list) Parameter Array (required)- This parameter represents the list of numbers from which nth...

1 minute read.

Text to columns in Excel

Microsoft Excel is widely used in startups to large companies. The data are entered in required rows and columns, and sometimes the data entered in one cell needs to enter...

4 minutes read.

How to apply Data Protection to the Worksheet?

What do we mean by Data Protection? Data Protection in excel involves in protecting your file/data from some other user and also prevents the following accidents – Accidentally deleting or changing the formulas in...

3 minutes read.