After you sort an Excel pivot table, the wrong item might appear at the top of a column. For example, in the screen shot below, the list of Sales Rep names has Jan at the top. Below that name, all the other names are sorted in the correct alphabetical order.
Do you ever make a quick pivot table, then spend the next 30 minutes trying to make it look good? Here are three quick pivot table layout tips, to make your job a bit easier!
If you have a report filter at the top of your pivot table, do the items in the drop down list ever appear out of order? That happens in my pivot tables occasionally, and there isn’t a quick and easy way to fix the problem!
Video: Sort Pivot Table Report Filters
In the short video below, I show the report filter problem, where the drop down list is not sorted correctly.
After that, I show a workaround that you can use, to get the sorting problem fixed.
If you notice that items are out of order in a pivot table report field, you might go to the Data tab on the Excel Ribbon, where the Sort & Filter commands are located.
However, the Sort commands are dimmed out, because you can’t use those in a Report filter field.
Why not? I have no idea!
Report Filter Sort Solution
Fortunately, there’s a workaround that you can use, to sort the report filter items.
It’s not complicated, but it’s a bit annoying that this is the only way to sort things!
To sort the report filter field, follow these steps:
First, drag the Report field down to the Row area of the pivot table body.
Next, right-click one of the pivot items in the Report field that you moved to Rows.
Because the field is in the Rows area, the right-click menu now shows the Sort command
The Sort commands on the Data tab are available too!
Click the Sort command, then click one of the sort options – Sort A to Z, or Sort Z to A.
When the sort is finished, drag the field bad up into the Report Filter area.
After you create an Excel pivot table, the source data usually changes. New records are added, and old records might be changed or deleted.
Later, when you refresh the pivot table, you should see a summary of your updated data, but sometimes there’s a problem – old data sticks in the drop down lists.
Example: Region Names Changed
To show this pivot table problem, I made short video, which you can see in the next section.
My sample file has data from a fictional sales company, and the source data was changed:
Central region was merged into the East region.
Sales records were changed from Central to East
After making those changes, I refreshed the pivot table. As expected, the Central region’s name disappeared from the Region headings.
However, Central still shows up in the Region drop down.
Video: Clear Old Pivot Table Items
In this short video, I show how you can clear the old Region name from the pivot table drop down list.
Doing this will also prevent old items from appearing in this pivot table, in the future.
Video: Clear Old Items – Default Settings
In Excel 365, and Excel 2019, it’s even easier to avoid old items in pivot table drop downs.
Instead of changing this setting for every pivot table that you create, you can change it once, in your Excel default settings for Pivot Tables.
In the video below, I show the steps for changing an individual pivot table, like I did in the previous video.
Then, at the 2:57 mark, I show how to change the default setting, in Excel 365. You can skip to that section, if you’d like!
Prevent Old Items in Pivot Table
To stop old items from showing in an existing pivot table, follow the steps below.
NOTE: This setting will affect all the pivot tables that use the same pivot cache.
First, right-click a cell in the pivot table
Next, in the right-click pop-up menu, click on PivotTable options
In the PivotTable Options dialog box, click on the Data tab
In the Retain Items section, there is a drop down for “Number of items to retain per field”
By default, that is set to Automatic.
Click the drop down arrow, and select None from the drop down list.
If you add times to an Excel Pivot Table, and format the time to show tenths of a second or hundredths of a second, zeros might appear after the decimal point.
The decimals for tenths of a second or hundredths of a second are rounded to zero, and changing the pivot table number format does not fix the problem.
Pivot Table Zero Decimals
In the screen shot below, I’ve highlighted the problem in the pivot table time column.
maximum time for the A team is 5:15:25 – 5 minutes, and 15 and 25 hundredths seconds
To fix the pivot table times, so they show tenths of seconds and hundredths of seconds, you can use a simple workaround.
To begin, follow these steps to add a column in the source data:
First, add a new column in the pivot table source data–in this example, TimeCalc
Next, in the new column, enter a formula with a simple link to the original time value cell in that row.
In the screen shot below, cell D2 has this formula: =C2
If the source data is in a named Excel table, the formula should automatically fill down to the last row.
Leave the new column in General format – do NOT change it to a time format
Add New Field to Pivot Table
After you add the new column to the source data, follow the steps below, to update the pivot table.
To refresh the pivot table, right-click on a pivot cell, and click the Refresh command
The new field will appear in the pivot table field list, where you can drag it to the pivot table’s Values area.
To show the maximum times, right-click on one of the new values, click Summarize Values by, and then click Max
Format as Time With 2 Decimals
Next, follow the steps below to format the times:
First, right-click on any cell in new pivot value column, and click the Value Field Settings command
Click the Number Format button, and click on the Custom category at the left.
To show the times with 2 decimal places, format the values with this custom number format: m:ss.00
This time format shows tenths of a second, or hundredths of a second.
Click the OK button to apply the formatting
The numbers are formatted correctly in the new field, tenths of a second, and hundredths of a second
To complete the changes, you can remove the original time field, which had the rounded tenths of a second or hundredths of a second, showing a zero instead of the correct numbers.
Get the Excel Workbook
To get the sample Excel file that I used in the video, go to my Contextures site, on the Pivot Table Time Fields page. The zipped file is in xlsx format, and does not contain any macros.
In a perfect world, if you need to make a pivot table, the data is nicely organized in a table, and you can connect to that, quickly and easily.
Unfortunately, as you know, things aren’t always perfect, especially when it comes to data! And sometimes the data is in two or more separate tables, so you need to combine it somehow, before you can build a pivot table..
4 Ways to Combine Data for Pivot Table
There are different ways you can combine data from multiple tables in Excel. For example:
Power Query
VSTACK Formula
Excel Macros
Pivot Table Wizard
Combine Data Videos
In the sections below, there are a couple of short “Combine Data” videos that I’ve made recently.
The first video shows how to use the VSTACK function, which is available in Excel 365. It returns multiple ranges in a vertical stack, so it’s easy to combine tables that have identical structures.
The second video shows how to combine data using the old Pivot Table Wizard. It creates a pivot table with several limitations, but it might do what you need – if you don’t need anything fancy!
Here’s the VSTACK function video, in which I combine the data from tables on 2 separate worksheets. It only takes one cell with a formula, to return all the data from the two tables.
I included the headings for the first table too, because pivot table data needs headings!
Video Timeline
00:00 Pivot Table from Multiple Sheets
00:20 VSTACK Function
00:52 VSTACK Formula
01:21 Combined Data
01:39 Named Range
02:11 Add Pivot Table
Pivot Table Wizard
What if you don’t have Power Query, or the Excel VSTACK function. And you don’t want to use Excel macros?
In that case, you can use the old Pivot Table Wizard to do the job. It’s well hidden in newer versions of Excel, but in the video, I’ll show you how to open it, with an Excel keyboard shortcut.
Video Timeline
0:00 Data on 2 Sheets
0:24 Open PivotTable Wizard
0:50 Select Sheet Ranges
1:08 Page Field Settings
1:29 Adjust the Pivot Table
2:04 Show Sum
2:15 Page Field
Get the Sample File
For all 4 methods to combine data, you can find detailed steps, and sample files, on my Contextures site.
When you create a pivot table, and select a cell in it, a pivot table field list usually appears, at the right side of the Excel window. See how you can adjust that list’s layout, width, and position. Also, see how we moved pivot fields in the olden days – do you remember the PivotTable Wizard?
After you press Enter, the pivot table layout changes.
The field that you typed moves into the active cell.
The existing fields shift down, and the added field takes its new position.
More Tips for Moving Labels
The first video above shows how to move pivot fields.
You can use a similar trick to move the pivot items in a pivot table.
The short video below shows how to move the Excel pivot items, and you can find written steps on the Move Pivot Table Labels page on my Contextures site.
In an Excel pivot table, you can use Excel’s built-in custom calculations, for a different view of the data.
For example, in the video below, I set up a pivot table to show what % of a company’s monthly sales were Binders. Also, what % of Binder sales was for each colour – red, blue, and black.