Pivot Table Complete Guide
Pivot Table Complete Guide
Pivot Table Complete Guide
This tutorial is for Excel 2019 for Windows. Got a different version? No problem, you
can still follow the exact same steps.
Table of Content
Many people have heard of Pivot Tables but fewer know exactly what they are.
If you are a business professional, you have likely seen Pivot Tables at work. If you are a job
seeker, you might have noticed Pivot Table skills are highly sought after.
So, what is a Pivot Table?
The best way to define it is: It’s a built-in feature of Excel that allows you to take data and re-
arrange it.
It creates a table that allows you to choose what and how you want to view your data.
For starters, they improve the ability to draw actionable conclusions from your data. This is
especially true of large sets of data with many different attributes.
Later, I’m going to show how you manipulate the filters, columns, and rows of a Pivot Table.
This allows you to quickly summarize and visualize the data from many different perspectives.
Follow the 6 steps to a Pivot Table outlined below. In a matter of minutes, you have
created your very first Pivot Table 🙂
Then you’ll learn how to create a Pivot Table from multiple sheets (which is
surprisingly handy).
We will use a data set that contains sales totals for some products of varying size and
price. The data set also includes data of each transaction as well as the wholesale price
for each.
4: In the ‘Tables’ group on the ‘Insert’ tab, click on ‘PivotTable’. The ‘Table/Range’ is
selected by default as your contiguous range of data (ensured by steps 1 and 2). Leave
the defaults selected in the ‘Create PivotTable’ dialog box.
5: Click ‘OK’ and your new worksheet will now be activated.
6: Choose fields to add to your Pivot Table as needed from the Pivot Table ‘Field List’.
Note: The ‘Field List’ is only visible if you click the cursor into the Pivot Table itself. If
you click into a cell outside the Pivot Table, the ‘Field List’ will become hidden.
The resulting Pivot Table is shown in the next figure. Note that ‘Month’ is set as the
columns while ‘Location’ shows as the rows, just as we set it up.
The Pivot Table sums up all the sales figures by location and month for us. This is just the
beginning of what Pivot Tables can do for you!
How to create a Pivot Table from multiple sheets
Now you know how to create a Pivot Table from data on a single worksheet.
In our example, we have three separate data worksheets for our locations. They are included as
sheets in the example workbook file.
1: Press Alt + D, then press P to make the ‘PivotTable and PivotChart Wizard’ appear.
2: Under “Where is the data you want to analyze?” select the radio button for “Multiple
consolidation ranges” and then click ‘Next’.
3: Select the radio button “I will create the page fields” and click ‘Next’.
4: The next thing you need to do is select your first data range.
In the example file, this will be the data table on the ‘Chicago’ tab and you need to select
the range from A2:H7.
5: Repeat the same process for both the ‘Nashville’ and ‘San Francisco’ location sales
data.
6: Now, highlight the first range in the ‘All ranges’ section. Then click the radio button
next to ‘1’ in the ‘How many page fields do you want?’ section.
7: Under ‘Field one:’ type in a name for the ‘page field’. In this example, simply type
‘Chicago’.
8: Now repeat this for the remaining two ranges. Then click ‘Next.
9: In step 3 of the wizard, leave the default setting of ‘New worksheet’ selected and click
‘Finish’.
The resulting Pivot Table should look like the following figure.
This Pivot Table has combined the sales figures from all three location worksheets.
One thing to note is the filter in cell B1. This filter allows you to select one or more of
locations.
Make sure the box next to ‘Select Multiple Items’ is checked. Now you can select or
unselect any combination of the filter items as you see fit.
Sometimes existing data changes. In this case, refreshing the Pivot Table is necessary.
To include this new data, you need to change your data source.
Then, you need to change your data source to expand it to the new range.
Let’s say you add October data to your original data. This original data has data from April
through September. You will need to expand the data source range to include the new rows of
Please note that there is a worksheet in the example file with a tab name of ‘Oct Data To Add’.
This can be copied and pasted to the original raw data on the ‘Sales Data Raw’ worksheet. This
makes it a bit easier to follow along with the next few steps.
Once you have added the new October data, go to your Pivot Table and click into any cell within
the Pivot Table.
Now click on ‘Change Data Source’ in the ‘Data’ group of the ‘Analyze’ tab.
Make sure ‘Table/Range’ (in the ‘Change PivotTable Data Source’ window) matches the range
that includes your new data.
Then click ‘OK’.
If it doesn’t match, you may need to manually select the entire range.
Just click a cell in the data, and use the shortcut Ctrl + A to expand to the new used range.
You should now be able to see the new October data as its own column in your Pivot Table
now.
Excel also allows for using ‘dynamic named ranges’ as data sources.
For more information about how to create ‘dynamic named ranges’ in Excel, check out this
resource.
In Microsoft Excel, you may have a named range that must be extended to include
new information. This article describes a method to create a dynamic defined name.
Note
The method in this article assumes that there are no more than 200 rows of data. You
can revise the defined names so that they use the appropriate number and reflect the
maximum number of rows.
To do this, follow these steps, as appropriate for the version of Excel that you are
running.
Microsoft Office Excel 2007, Microsoft Excel 2010 and Microsoft Excel 2013
1 Month Sales
2 Jan 10
3 Feb 20
4 Mar 30
2. Click the Formulas tab.
4. Click New.
=OFFSET($A$2,0,0,COUNTA($A$2:$A$200),1)
7. Click New.
=OFFSET($B$2,0,0,COUNT($B$2:$B$200),1)
10.Click Close.
=RAND()*0+10
Note
This formula uses the volatile RAND function. This formula automatically
updates the OFFSET formula that is used in the defined name "Sales" when
you enter new data in column B. The value 10 is used in this formula because
10 is the original value of cell B2.
A B
1 Month Sales
2 Jan 10
3 Feb 20
4 Mar 30
=OFFSET($A$2,0,0,COUNTA($A$2:$A$200),1).
5. Click Add.
7. In the Refers to box, type the following text, and then click Add:
=OFFSET($B$2,0,0,COUNT($B$2:$B$200),1)
8. Click OK.
=RAND()*0+10
Note
You can find this in your original data for your Pivot Table.
To solve this, filter on that product code and change the sales price manually.
The new price for all these rows of data will have an impact on the amounts in the ‘Total’
column.
The next step is to go back to the pivot table and click into it so that we can see the Analyze tab.
Now find the ‘Data’ group and click ‘Refresh’.
Notice in the following figure how the ‘Grand Total’ has increased due to the price change we
made.
Your Pivot Table is created and you’re super excited to use it.
Topics:
Fields
o Adding columns
o Report filters
Value field settings
o Average
o Count
o Distinct count
Grouping
Calculated fields
Drill down
Use data from a Pivot Table in a formula
By separating data into their respective ‘fields’ for use in a Pivot Table, Excel enables its user to:
Display datasets in a more logical output e.g. ‘Total Units Sold’ in San Francisco. This is covered
in greater detail later when we discuss ‘Value Field Settings’.
Extract and display relevant data by organizing it in a way that is more suitable – either
figuratively or aesthetically.
Filter the data accordingly based on values found in the selected ‘field’.
Now we have our blank table with which to start arranging the data with our Pivot Table ‘fields’.
All available fields found in the data set – as defined by its headers – are listed on the right-hand side in
the ‘PivotTable Field List’ area.
To add data columns into the table, drag and drop the desired field into
‘Column Labels’, ‘Row Labels’, or ‘Values’ (these 3 are also covered in more detail
later).
This example setup would list the data in rows separated by ‘Location’ and ‘Item’.
Columns are separated by ‘Month’.
This forms a grid to display the ‘Total of Units Sold’ in each ‘Location’ by ‘Month’.
1. The ‘Location’ totals for each month are now viewed as subtotals for each month.
2. The breakdown by ‘Item’ is also visible within each ‘Location’.
To hide ‘Item’ rows, click on the minus next to the ‘Location’ rows.
What if you needed to provide a look at units sold by item for all the locations?
If you want to select multiple entries from the filter, check the box next to ‘Select
Multiple Items’ at the bottom of the drop-down.
Then you will be able to select all available entries in the filter in whatever combination
you need.
Here we will select “Car” Rack and note the change in values:
How to Create a Drop-Down List in Excel:
A drop down list is actually a tiny window from where you can peek into some other data you
have constructed.
This also gives you the possibility of controlling exactly what can be entered into a cell. This
makes the drop-down menu a very common and powerful data validation tool.
Before we start the clock, let’s take a look at the data in the sample file.
First we have a sheet with all the names of our employees.
This is the data we would like to see when opening our drop-down menu.
Then we have the “gateway” where we want to be able to scroll through all the names on the
other sheet.
This “gateway” is placed in the “Dropdown” sheet of the Excel sample file.
Simply move your cursor to the “Data” tab and click it.
Step 2: Click “Data Validation”
Now click the button “Data validation” in the middle of the ribbon (do not click the little
arrow – simply click the top part of the button).
Click the arrow next to the field and click “List” from the… well… list!
That’s where I’ve put all the employees for our drop-down list.
Now it’s time to tell Excel that our drop-down should be connected to that data.
Then click the “Data” sheet and select all the employees.
OK”.
There’s a neat shortcut you can use to select all the employee names in (almost) an instant.
Redo is the opposite of ‘Undo’. It’s useful when you want to reverse an undo action.
Repeat an action lets you… Well… Repeat an action! 😊
You made a weekly expenses tracker and you just finished writing a ‘SUM’ formula of all
your expenses during the week.
However, you mistakenly pressed ‘Ctrl + Z’ thinking you missed the first amount and
deleted the formula.
Instead of rewriting it, all you have to do is use the ‘Redo’ function
by pressing ‘F4’ (‘Ctrl/⌘ + Y’ if ‘F4’ doesn’t work).
By the way, there’s no way you can use the ‘Redo’ and ‘Repeat an Action’ functions at the
same time.
Once you ‘Undo’, Excel automatically sees the shortcut as ‘Redo’. But if you did
something like highlight a certain cell, the shortcut is in ‘Repeat an Action’ mode.
To illustrate, let’s say you want to highlight all the amounts under the “Groceries”
category:
Oftentimes, we place the sum total at the end of a column or row with the values we
want to add.
When adding numbers in a column or row, the usual method is by using the ‘SUM’
function and entering the range of the addends.
If you need to check whether the formula you entered covered all the cells
needed, simply use the shortcut ‘Ctrl + [‘ (‘^ + [‘ for Mac).
Show/Hide Formulas
If you like to check the formula itself, you can show or hide the formulas
by pressing ‘Ctrl + `’ (‘^ + `’ for Mac). The (`) is the grave accent mark key located
in the upper left corner of your keyboard.
Insert/Delete a Row/Column
Using the mouse to insert a column/row is done by either:
Clicking the ‘Insert’ button under the ‘Cells’ category on the Ribbon
Right-clicking the headings and selecting ‘Insert’ where you want to insert a row/column
To add a row/column, select the row/column where you want to insert the new
row/column and press ‘Ctrl + Shfit + +’ (‘^ + I’ for Mac).
To delete a row/column, press ‘Ctrl + -’ (‘^ + -’ for Mac).
Hide a Row/Column
If you wish to hide rows and columns without deleting the data, you can simply format
them to do so.
The ‘Hide & Unhide’ formatting is found in the Ribbon under the ‘Cells’ category as
shown below:
The shortcuts are much easier.
Apply/Remove Filter
Using filters let you slice and dice your data.
Excel has AutoFilter and advanced filters to help you hone in on the information you want to
see.
The ‘Filter’ button is found on the Data tab under ‘Sort & Filter’ category of the Ribbon.
Instead of manually writing down the date, you can simply use the shortcut — ‘Ctrl
+ ;’ (‘^ + ;’ for Mac).
Apply Date Format
The date you’ll get after using the shortcut is in dd mm yyyy format.
Conclusion
When selecting the cells for the source, select the first name you encounter (in cell A2) – then
hold down Ctrl + Shift and click the down arrow on your keyboard. You’ve now selected all the
names in the sheet in just a few seconds.
Step 5: Here’s the end result!
This displays ‘Total Units Sold’ for each ‘Month’ and ‘Location’ listed in the Pivot Table.
By using different ‘Value Field Settings’, the data in the field presented
under ‘Values’ is presented in different ways.
To access a field’s ‘Value Field Settings’, click on its entry. Then select it from the
resulting drop-down:
There are several possibilities for ‘Value Field Settings’. I’m going to show you the most
common.
These settings are only available for fields placed in the ‘Values’ area.
Average
Click on ‘Value Field Settings’ and select ‘Average’.
This tells the Pivot Table to average the content of all the entries in that field and display
that as the value.
But, this doesn’t tell you anything about how many entries (transactions) there are.
Count
Selecting ‘Count’ tells the Pivot Table to add up the number of entries in that field.
Notice how the upper left cell has changed to show it is now displaying values as ‘Count
of Units Sold’.
This data shows that there are 25 transactions occurring in April at Chicago.
Using the example data with ‘Units Sold’, let’s say two transactions in April at Chicago
both sold 5 units.
Notice how the upper left cell has changed to show it is now displaying values as
‘Distinct Counts’.
Using ‘Distinct Count’ is a useful ‘Value Field Setting’.
For instance, if you wanted to count how many types of an Item was sold in each month
at each location.
Grouping
Still using the above example, the fields have been set up.
Any relevant filters are applied and the ‘Value Field Settings’ have been set to ‘Sum’.
What if you no longer want to see it monthly, but want to see the data organized
into financial quarters?
First, select any entries you wish to group (this is only applicable for ‘Row’ and ‘Column’
fields).
Doing this for the remaining months splits them into quarters as follows:
To rename the separate group entries, click on their cell and replace the text.
In this case, ‘Group 1, 2, and 3’ are replaced with ‘Quarter 1, 2, and 3’.
Add ‘Subtotals’ to the groups by right clicking on ‘Quarter’ and select ‘Subtotal “Quarter”’.
Now you will have subtotals for ‘Units Sold’ by quarter.
If the sub-entries are no longer needed, collapse each group using the +/- box next to each
‘group field’.
Calculated Fields’ allow you to insert values into the Pivot Table based on formulas.
Let’s say the manager at each location gets a bonus percentage added to his salary. This bonus
is based on the number of units sold each month.
If that bonus % was equal to Units Sold / 100 we’d have to add more data to the original
table to be able to calculate this.
Experiment using different operations and using different fields to see what is
possible.
Using the example of ‘Bonus’ as a new ‘Calculated Field’, inserting it in the ‘Values’ area
yields:
Now it’s easy to see what percentage bonus each manager should get in each
month.
Namely, view the results that comprise the given value entry on the table.
This is broken down into ‘Month’ and ‘Location’ on a 2×2 grid layout (as in the earlier
examples).
Let’s say you are asked for a list of transactions that comprise the entry in May at San
Francisco.
Then the Pivot Table’s collapsible functionality has hidden these details from view!
The operation of drilling counters this. Instead, every record associated with that field
entry is displayed.
Using the above example, right click the ‘Value’ cell associated with May and San
Francisco.
You now have an auto-generated list of entries for this data point.
For example, you use a Pivot Table to create a report from a set of sales data.
Although a Pivot Table is powerful, you still have plenty of uses for other
formulas in Excel. Sometimes, these formulas refer to data inside a Pivot Table.
This poses an issue; what happens when the Pivot Table is rearranged?
Excel has made the ‘GETPIVOTDATA’ function to help you with references to Pivot
Tables.
This function glues together the references and the cell they are referring to. It’s just like using
relative references.
The ‘GETPIVOTDATA’ function is unique. As opposed to other functions, all you need to
do is to click a cell.
Type the equal sign and click a cell with data within the Pivot Table. Then hit ‘Enter’.
GETPIVOTDATA(“Units Sold”,
$A$3,”Location”,”Nashville”,”Month”,”April”)
‘Data_field’ = Name of the field whose value is desired. In this case, “Units Sold”.
‘Pivot_location’ = Cell reference to the top left cell of the Pivot Table. In this case, an
absolute reference to A3.
The fields and items are extra identifiers to tell where the cell is located.
You can edit a ‘GETPIVOTDATA’ function but don’t try to create it from scratch
yourself. Let Excel do all the work and just click the cell within the Pivot Table when you
need it.
Pro tip
Try to remove a field from the field list. If that field removes the cell entirely, the
function returns an error.
The function recognizes the reference again and returns the result.
Topics:
Sorting by value
Sorting by date
Sort Top 10 using the value filter
Filter and organize data using ‘Slicers’
For all examples in this section, you need to set up your Pivot Table in a specific way.
Use the raw sales data with the following ‘field’ structure:
This lists all the ‘Transactions’ as ‘Rows’. ‘Total Units Sold’ as ‘Values’ separated into ‘Columns’
depicting ‘Months’.
Sorting by Value
Ensure the ‘Item’ filter is set to include ‘All Values’.
Notice, the ‘Transaction field’ contains data in the format of an 8-digit number (e.g.
20100000).
When the Pivot Table is formed in the above way, the rows are populated and sorted in
ascending numerical order:
By default, Excel will sort any numerical, alphabetical or dated list. All it requires is a logical,
natural order. Such as 1 2 3, a b c, Jan Feb Mar etc.
Access the drop-down arrow next to the field of your choice to see available sort options.
Notice how the data has now been flipped upside down. This is confirmed by entries
showing for October instead of April. This is indeed in the last segment of the data.
Sorting by Date
Dates (including day names, month names, years) are logically understood by Excel
as ordered lists.
The above method can be applied to the ‘Month field’ in the columns to sort them into
their reverse order:
Using the Value Filter to Sort Top 10
Besides the mentioned ‘Sort’ methods, Excel has a built-in method to present the ‘Top
10’ records.
As an example, say we want to see the ‘Top 10’ transactions for total units sold.
You will be prompted to select how many ‘Top’ entries to display (in this case, we want
the top 10).
You also need to select which ‘Value Field’ to base the selection on. As we only have
‘Units Sold’ listed as values, currently that is the only option.
In this case, transactions with 6 units sold make it into the Top 10:
Slicers
‘Slicers’ offer a more intuitive way to filter and organize the data within a Pivot Table.
Ensure the Pivot Table is selected and navigate through ‘Options’ -> ‘Insert Slicer’ from
the Excel Ribbon:
In the proceeding dialogue, you will be asked to select which field(s) to be toggled from
this ‘Slicer’.
For this example, select ‘Month’ and move the resulting ‘Slicer’ to the right of your Pivot
Table:
The ‘Slicer’ is now populated with all available values for ‘Month’.
These are based on all its findings within the source data for the Pivot
Table.
This user interface avoids the need to enter the Pivot Table manually to apply your
filters.
‘Slicers’ can even contain fields that are not currently presented in the Pivot
Table. Let’s say the table was sliced on ‘Item’. This could be used to only show values for
‘Units Sold’ for each item separately. It could also be grouped however you desire.
In this part of the tutorial, you’ll learn about the most common and best options.
Topics:
These layouts are available in a range of color schemes. These color schemes are grouped into
three categories; Light, Medium, and Dark.
If you have another version of Excel, it might be categorized a bit different. Some third
party add-ins also affect the categorization.
The variety that suits your report the best will be dependent on any current color
schemes you have.
It also depends on whether you have some other formatting to consider.
The ‘Style’ formatting takes a low precedence. This gives way to any ‘hard’ formats
you may have already applied to cells in the Pivot Table manually. This would include
formatting such as ‘Background Fills’, ‘Font Color’, etc.
Banded Rows
Excel also enables you to ‘band’ the rows within the selected ‘Style’ and color scheme.
This makes it much easier to trace rows from the initial column through to
its contained data.
Select the checkbox ‘Banded Rows’ within the ‘Style Options’ group for the Pivot Table.
The depth of color is dependent once again on the style already selected.
Report Layouts
Excel allows 3 main types of report layouts to be applied to you Pivot Tables.
These are:
Compact
Outline
Tabular
Compact Form
2: The ‘row field’ label is always above the labels for its inner fields
Outline Form
The benefit?
2: The ‘row field’ label is always above the labels for its inner ‘fields’
Tabular Form
1: All row labels for outer fields are on the same row as their first inner field
4: Subtotals for ‘row fields’ are always shown at the bottom of each group
Highlight the relevant data and navigate to Home -> conditional formatting.
In this example, we will look at highlighting all items that have sold more than 50
units in a month.
Follow the prompt that opens and enter 50 as the boundary for the formatting causes
the following:
Find them under ‘Highlight Cells Rules’ such as ‘Less Than’, ‘Between’ and ‘Equal To’.
Each is geared to highlighting data that can be segregated in some way against a
benchmark.
To learn more about conditional formatting in Excel, read our in-depth guide here.
To apply a conditional formatting rule to the entire Pivot Table, use the 2nd or 3rd
options in the button that appears after using conditional formatting.
Number formats
Some data displays in an inherent logical way (e.g. currency starting with $ or £).
In other cases, it might be a case of how precise the data should be (e.g. number of
decimal places).
Modifying these characteristics in the display of a Pivot Table allow a more appropriate
representation of the data.
Total sales for the 5 items listed are displayed for the months of April, May and June:
While we might be able to guess that the numbers relate to money values, it is not immediately
obvious.
To solve this:
Select the values in the Pivot Table, right-click and select ‘Format Cells’.
Then make your choice for which format you want in the ‘Negative numbers’ box.
Select 2 in the ‘Decimal places’ combo box and click OK.
It is now easy for the user to see the type of data being displayed.
Removing blanks
If there are gaps in the source data, these will be detected by the Pivot Table and
identified as (blanks).
Following the ‘Filtering’ sections of this guide, you have come across these already.
To remove the blanks from an active filter, uncheck the box next to it from the filter
menu.
Blank values don’t affect anything calculable within the Pivot Table. But, they damage the look
and feel of it. Blank values make it more difficult to view the data. This completely
defies the point of using a Pivot Table in the first place.
It is worth noting that the same also applies to any ‘Slicers’ that are linked to the Pivot
Table.
Simply deselect the entry for ‘(blank)’ and they are removed from the Pivot Table.
As a result, you might need to change this name to better reflect the nature
of the data presented.
In the context of the original source data, this was more obvious based on the columns
that surrounded it.
But, now it has been extracted for a more streamlined view in a Pivot Table.
So, it is no longer as obvious.
Something like ‘Total Turnover’ or ‘Total Sales’ is more appropriate in this situation.
To apply this change, we need to access the ‘Field Settings’ for this field.
Select the cell containing ‘Sum of Total’ and navigate to the ‘Options’ tab in the Excel
Ribbon.
Under the ‘Active Field’ group, you will find ‘Field Settings’.
Now open the ‘Field Settings’ menu.
Selecting ‘OK’ will update the field name on the Pivot Table:
The label is now more representative of the data being displayed and more obvious to
whoever views it.
Pivot Charts
Pivot Charts visualize your Pivot Table in an instant.
Topics:
This becomes available for use in its graphical counterpart – the Pivot Chart.
In short, a Pivot Chart takes the data contained in the Pivot Table and outputs it
in a graphical medium.
Bar Charts
Line Graphs
Pie Charts
Navigate to the ‘Insert’ tab on the Excel Ribbon and select the desired chart from the
‘Charts’ group:
Excel offers a wide array of choices for each type of graph available.
For the sake of illustration, a simple ‘2D Pie Chart’ will suffice.
In the ‘field list’ on the right, the ‘Areas’ section at the bottom changes.
This happens to better represent what can be modified on your Pivot Chart.
Notice that ‘Row Labels’ has changed to ‘Axis Fields’.
These are the corresponding areas on graphs of all kinds, hence the use of ‘Axis’ even on a Pie
Chart. The Pivot Table information will be pulled through these areas.
With the set up on the left using the data from the ‘Sales Data Raw’ (Price change)
worksheet, a pie chart’ is displayed.
This pie chart shows the ‘Total Sales’ in its values, split into categories defined by Item
type.
As pie charts are 2-dimensional, the equivalent ‘Columns’ entry (now a ‘Legend Field’)
cannot be displayed.
Any field entered into the areas ‘Legend Field’, ‘Axis Field’ or ‘Report Filter’ displays a button
on the Pivot Chart…
In the previous illustration, the month as a ‘Legend Field’ can be manipulated.
For instance, to present single months or multiple months (in the case of a pie chart,
acting as a filter).
If this was a bar chart, these would be plotted as separate entries on the same graph as
opposed to swapping with the data currently present.
The most important point to note is: The Pivot Chart has fantastic abilities to filter and
represent the data. Just like the Pivot Table achieves the same.
Let’s look at an example of a Pivot Table we have set up with the month as our rows.
We want the ‘Month’ values to sort naturally the way they occur
sequentially through the year.
But, something is wrong with our source data so our values are sorting alphabetically.
We need to see the ‘Month’ values sorted in the order they fall in the year.
One of the most common causes of this is trailing spaces. These are not
visible to the naked eye. So, we need to ensure that our ‘Month’ values do not have
extra spaces by using the trim function.
Simply add a column next to ‘Month’ and type in the ‘TRIM’ function as shown in the
previous figure.
Then Copy the entire column less the header and paste as values in the ‘Month’ column.
Everything looks just like it did before, but now we know that our ‘Month’ values
contain no extra spaces. This has cleaned our values and changed how Excel will now
detect them.
Upon refresh of the Pivot Table, the ‘Month’ rows now sort naturally in sequential order.
Awesome, right?!
Pivot Table field name is not valid
Sometimes your source data may have a missing column header.
This could be due to a blank column mixed in with the source data.
It could also be a column with data that just has a blank header like the
following:
Note columns F and H: This is one example of a completely blank column and the
other with a missing header for a column of data.
If you attempt to create a Pivot Table with this data set, Excel will return the following
error:
Then you (manually) need to type in any missing headers for data columns:
Be aware that this doesn’t only effect Pivot Table creation!
Let’s say this source data is changed after a Pivot Table is created and a header is
removed.
When the Pivot Table undergoes an update/refresh the same error will be
encountered (the same solution applies).
When it comes to pulling this data into a Pivot Table, any ‘fields’ formed must have
unique names (as it too is a ‘List Object’ like a normal ‘Table’).
If Excel comes across several columns with the same header, it tries to handle
it. This is done by suffixing an incremental number to the ‘field’ name. This happens
correspondingly to the left-to-right order the columns are found in the data.
You might run into this kind of issue where the ‘Month’ column header is actually a
duplicate ‘Date’ header.
When you go to create your Pivot Table, you will notice that Excel has added a ‘2’ on the
end of the second ‘Date’ header.
Recall from the earlier section about renaming Pivot Table ‘fields’?
Here, I showed how you can easily change this in your Pivot Table itself.
Just keep in mind that this does not change the header in the source data. For ‘value fields’
Excel will not allow the reuse of ‘field’ names that already exist in the source
data.
To add it to your view, navigate to ‘File’ -> ‘Options’ as in the next figure.
From here select the sub menu ‘Customize Ribbon’.
Select ‘Commands Not in the Ribbon’ in the drop-down menu for ‘Choose Commands’
from:
Add this to whichever Ribbon entry you desire. It makes the most sense to place it on ‘Insert’
where the Pivot Table ‘Insert’ button is.
Activate the Pivot Table / Chart wizard with this shortcut
Alternatively, the Pivot Table / Chart wizard is directly accessible using the following
keyboard shortcut:
Alt + D, then P
It contains all the available ‘fields’ from the source data used at the top.
These are:
Filters
Columns
Rows
Values
The ‘Field List’ is hidden by default until you select the Pivot Table. Can’t find it?
Then your first step is to make sure that the cell selected on the active worksheet belongs to the
Pivot Table.
If the list is still invisible after this, it is likely it has been manually hidden.
To unhide, navigate to the ‘Show’ group on the ‘Analyze’ tab and click on ‘Field List’.
Alternatively, you can also go to the ‘Show’ group on the ‘Analyze’ tab and see that ‘Field
List’ is unhighlighted.
Your ‘Field List’ should now appear in its usual place on the right-hand side of the
worksheet.
So, you can hide the Field List with the same procedure. Just click it in the ribbon to
return it to its unhighlighted and hidden state.
You must ‘Change Data Source’ to ensure that your Pivot Table data range
includes any new data. You do this by clicking into your Pivot Table to make sure the
‘Options’ tab is visible in the Ribbon. Then simply click on ‘Change Data Source’ in the ‘Data’
group.
The ‘Change PivotTable Data Source’ dialog appears showing the current selected table
or range.
The best way to update all the way to the last row of your data (assuming there were no
columns added) is to press:
Does the table/range box indicate that entire columns are selected? Then press Ctrl + Shift +
the up arrow to bring the bottom of the range to the last row of data.
Now you simply need to click ‘OK’ and then click ‘Refresh’ once again.
This should now update your Pivot Table to include the newly added data.
Excel must apply the same grouping logic to all entries in the ‘field’. This is obviously not
possible if they are of different types.
2: At least one of the ‘fields’ contains blank cells (gaps in the data).
Excel cannot handle an empty value when trying to group with another ‘field’ that has
no empty values.
Then go back to the source data and ensure the column in question is all formatted as
the same type (e.g. ‘Currency’ for price/money entries, ‘Text’ for textual entries etc.).
If point 2 applies, it is rarely an acceptable solution to add data into the blanks to
make grouping work. This data has no true meaning and is false.
The question instead is whether this column makes sense to be grouped with another.
Perhaps the answer is no and a different approach should be undertaken.
If you want to summarize text data, you must use another tool or use a
workaround.
This great guide by Chandoo tells you how to deal with summarizing text data as a
‘Value Field’.
Additionally, you will be able to apply what you’ve learned to a broader range of real life
scenarios.
I’ve made it easy for you to practice what you’ve learned in this tutorial.
FREE Assignment workbook
Download this assignment workbook and start practicing using pivot tables.
Wrapping up
As you’ve just learned, Pivot Tables is one of the most powerful tools in Excel.
Why? Because no other tool in Excel has this much impact on your daily work.
Reports that normally would take hours to complete you can now finish in minutes.
Does your boss want you to change the report right before a meeting?