×

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

Excel SECOND() Function

Excel SECOND() Function The SECOND() function in excel converts a serial number to SECOND (0 - 59). Syntax SECOND (SERIAL_NUMBER) Parameter SERIAL_NUMBER (required)- This parameter represents the date or time from which you want to extract...

1 minute read.

Excel SUBSTITUTE() Function

The SUBSTITUTE() function in excel substitutes/replaces the old text with the new text in a string. SUBSTITUTE function is used to clean data. This function is case-sensitive. Syntax SUBSTITUTE(Text, Old_Text, New_Text, [instance_number]) Parameter Text (required)- This...

2 minutes read.

How to lock cells in Excel?

How to lock cells in Excel? The locked cells feature used to protect and secure your Excel sheet or workbook from the unauthorized access. If the cells are locked, it can’t be deleted, reformatted,...

5 minutes read.

Excel LEFT() Function

The LEFT () function in excel returns the leftmost characters from a text value. This function is used for data manipulation. Syntax LEFT(Text, [num_chars]) Parameter Text (required)- This parameter represents the string from which you want to...

1 minute read.

Excel OFFSET () Function

Excel OFFSET () Function The OFFSET() function in excel returns range of cells that is a specified number of rows and columns from an initial specified range. Syntax OFFSET (reference, rows, cols, [height], [width]) Parameter reference(required)-...

2 minutes read.

Excel Unique Values

The Unique function in Excel filters the list of unique values from the given data like range or array. The data presented is either number, text, date, time etc. This...

3 minutes read.

How to Alphabetize in Excel?

Alphabetize in Excel One of the reasons for Excel's widest popularity is its ability to swiftly and effortlessly sort data. Excel facilitates easy methods that alphabetically sort the lists of strings...

5 minutes read.

Calculating Age in Excel

Microsoft Excel provides separate functions for various mathematical operations. Nowadays, Microsoft Excel is widely used by large and various organizations. Using formulas one can calculate the statistical functions quickly and...

2 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.

SUM Functions in Excel

The BODMAS formula plays a vital role in the concept of mathematics. BODMAS rule follows the Bracket of Division, Multiplication, Addition and Subtraction. This rule is followed for a correct...

6 minutes read.

Excel OR() Function

The OR() function in excel tests the multiple sets of conditions and returns TRUE if any of the arguments are TRUE and FALSE if all the arguments supplied do not meet the...

2 minutes read.

How to create drop down in excel?

How to create drop down in excel? Drop-down lists are mostly used to facilitate data entry operations. They are commonly used in interactive websites or applications. Microsoft has expanded his Excel's data validation feature...

5 minutes read.

Square Root Function in Excel

The concept of Mathematical calculations includes a large number of numbers and calculations are based on the numbers present in the data. Likewise, Square Root is a function used to...

3 minutes read.

Excel AVERAGE() Function

Excel AVERAGE() Function The AVERAGE() function returns the average of its arguments, which can be number or names, arrays, or references that contain numbers. It ignores text values and blank cells. Syntax AVERAGE(Number1,Number2, ...) Parameter Number1(required)- This parameter...

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.

Trendline in Excel

A Trendline is a line imposed on a graph to predict the direction of the data. It connects the series of data together to showcase the data best fit. The...

3 minutes read.

Averageif Function in Excel

Average If in HTML In Mathematics, Average function is used to find the arithmetic mean of the given data. It is defined as the dividing the sum total of given data...

7 minutes 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.

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.

Cells and Ranges in Excel

Cells and Ranges Each cell is identified by its cell address, which is a combination of the column and row on which that cell is situated. A group of cells together are called ‘Range’. When...

5 minutes read.