Search Contextures Sites
- Create a Pivot Table from Data on Different Sheets
- Create a pivot table from multiple consolidation ranges
- Video: Create a Pivot Table from Multiple Sheets
- Limitations of multiple consolidation ranges
- Alternatives to Multiple Consolidation Ranges
- Download the Sample File
- Excel Pivot Table Tutorial List
To create a Pivot Table, you can use data from different sheets in a workbook, or from different workbooks, if those tables have identical column structures.
However, you won't get the same pivot table layout that you'd get from a single range.
If possible, move your data to a single worksheet, or store it in a database, such as Microsoft Access, and you'll have more flexibility in creating the pivot table.
If combining your data isn't an option, this pivot table tutorial explains the steps to create a pivot table from multiple consolidation ranges, describes the limitations, and suggests workaround solutions.
- Choose Data | PivotTable and PivotChart Report (In Excel 2007, press Alt+D, then press P)
- Select Multiple consolidation ranges, click Next
- Select one of the page options, click Next
- Select each range, and click Add
- If you chose 'I will create the page fields', you can select each range, and assign field names, in step 2b
- Click Next
- Select a location for the PivotTable, then click Finish
- In the Column dropdown, hide any columns that contain meaningless data. For example, the Colour column might contain all zeros, because the colours are text, not numbers.
To see the steps for creating a pivot table from data on different sheets, what this multiple consolidation ranges pivot table video tutorial.
In this example, Item is the first column in the data source, and the pivot table row heading shows the item names. Remaining fields are shown in the column area.
You can change the function (e.g. SUM) that is being used by the data value, but it will use the same function on all these columns. The Pivot Table contains some meaningless data, such as sum of Date and columns full of zeros where the database columns contain text.
To get the best results, rearrange your database columns, so the most important column is at the far left. That column of data will become the Row values in the pivot table.
If there are columns that you don't want in the pivot table, move those to the far right in the source data. Then, do not include those columns when selecting the data ranges for the pivot table.
To avoid the limitations of multiple consolidation ranges, you can try one of the following alternatives.
If you can't combine your data on a single worksheet, another solution is to create named ranges in an Excel file, and use Microsoft Query (MS Query) to combine the data. There are sample files here: http://www.contextures.com/excelfiles.html#PT0007
Then, use the Union query (full outer join) result as the pivot table's source data.
With this solution, you’ll end up with a normal pivot table, with none of the limitations. However, it’s a bit tedious to set up, especially if you have more than a couple of tables.
You can read more about MS Queries here:
Instead of manually setting up a union query, you can use the code in a sample file from Excel MVPs, Kirill Lapin (KL), with amendments by Héctor Miguel Orozco Diaz.
Before you use the sample code, replace the sample sheet names with the sheet names in your workbook.
For example, if your sheet names are "East" and "West", change this line of code:
arrSheets = Array ("Ontario", "Alberta")
arrSheets = Array ("East", "West")
In the code, you can also change the location where the pivot table will be added. In the sample file, the TableDestination is set for the active sheet, in range A1.
Then, after you make those small changes, click the button on the worksheet, and a summary pivot table is automatically created.
To download the sample file from Kirill and Héctor, click here: Pivot Table From Multiple Sheets.
Kirill Lapin shares his code to create a Union query and build a fully functional pivot table from data in multiple Excel files. For instructions, read the Contextures Pivot Table Blog article:
Macro Creates Excel Pivot Table From Multiple Files
There also an example file that creates either a pivot table or a formatted Excel table from the consolidated data. Download it from the Excel Sample Files page, in the Pivot Tables Section: PT0033 - Pivot Table or Excel Table from Multiple Files
Download the sample pivot table tutorial file
Xtreme Pivot Table Course
Pivot table skills are essential, if you want to be an Excel master. To raise your skills to the expert level, I recommend the Xtreme Pivot Table course, from John Michaloudis, at My Excel Online.
This course has more than 200 videos -- beginner, intermediate and advanced level -- along with practice workbooks, finance business cases, and 12 months of personal support. Each short lesson is clear, and easy to follow. Work through the lessons at your own pace, and track your progress. The course is an excellent value, at a surprisingly low price.
See the course details, and watch sample videos here: Xtreme Pivot Table Course. When you buy the course, use the coupon code CONTEXTURES for a 10% discount
- Add-In: PivotPower Premium
- Beginning Pivot Tables Book
- Pivot Tables Recipe Book
- Xtreme Pivot Table Course - Use code CONTEXTURES for 10% discount.
- Pivot Table Introduction
- Grouping Data
- Pivot Table from Multiple Sheets
- Running Totals
- Summary Functions
- Clear Old Items in Pivot Table Drop Downs
Contextures Inc., Copyright ©2014
All rights reserved.
Last updated: July 19, 2014 10:56 AM