With a pivot table, you summarize your data within a few seconds. You can create reports, analyze data, and easily share with others.
That's the beauty of pivot tables.
But here is a twist:
Normally when you create a pivot table you can select source data from a single table in a worksheet as Excel doesn't allow you to refer to different worksheets.
But sometimes, it happens that we need to use the source data from multiple worksheets to create a pivot table.
So today, I'd like to share with you simple steps to use multiple worksheets in a pivot table.
Assume that you want to analyze the sales data of your company and you pull out the yearly data for the last 4 years.
This is how you get the data dump in Excel.
Please note, the data in all the 4 sheets is different but the structure is exactly the same i.e. same number of columns and heading.
Now, to analyze this data, you need to make a single pivot table report from these multiple sheets.
Some of the common methods are:
But the thing is, these methods require coding, copy-pasting, or, are repetitive.
Here I am going to discuss a new method using Microsoft query which is dynamic, robust and simple.
Trust me you’ll love it!
By using Microsoft query you can create a pivot table from multiple worksheets.
Download this data file to follow along.
Here we have simple steps which you can follow and before that, please download this file from here to follow along.
Select * from Year2005
Union all
Select * from Year2006
Union all
Select * from Year2007
Union all
Select * from Year2008
NOTE: Pivot Tables are one of the INTERMEDIATE EXCEL SKILLS.
Hi, I have created a pivot which is created by power query and I tried to create multiple worksheets from the filter values but it shows an error but the code runs fine in the normal pivot, could you please help me to find the solution. Reply
Hi Puneet,
Thanks for sharing this great piece of work. There is no file link to download for practice.
Can you please help? Reply
Thank you for sharing, worked for me with tweak to SQL query, my solution below which selects just specific columns (using my tab & column names) One other point – seems Excel saves a fixed filename in the query string, so you can’t easily rename your file without updating the query string under Data > Connections > Properties (of existing query) Example SQL query:
SELECT CoinsSheet.Date, CoinsSheet.Name, CoinsSheet.Amount, CoinsSheet.Project FROM CoinsSheet CoinsSheet
Union All
SELECT DonationsSheet.Date, DonationsSheet.Name, DonationsSheet.Amount, DonationsSheet.Project FROM DonationsSheet DonationsSheet
Union All
SELECT PledgesSheet.Date, PledgesSheet.Name, PledgesSheet.Amount, PledgesSheet.Project FROM PledgesSheet PledgesSheet Reply
Hi, thanks for posting this – it has worked really well for my expenses log in the most part. However, I’m running into a problem whereby some of the key fields in my report are returning as [blank] – even though there is an entry in there on the source table. Do you know any reason why this might be the case? I’m trying to combine 13 separate worksheets from the same workbook. They all have the same number of columns and headings. Some of these are only 60 rows, whilst some are around 800 rows. I don’t think this should cause the problem though should it? Reply