Multiple worksheets as the source for a pivot table

D

Dan M. Hess

Can you use more than 1 worksheet as the source for a pivot table?
I saw where I could use multple consolidations, but I don't think
consolidation will work for me. I need to count records by month.
 
S

steven1001

The following may be worth trying....
A spreadsheet called c:\JUNk\123.xls has a two worksheets 'march' and
'april' each with columns 'account', 'date' and 'value'

On a new worksheet in the same (or another) spreadsheet use >Data
Import External Data >New database Query, select 'Excel' files as the
data source. Find the spreadsheet called C:\JUNK\123.xls. Click on the
'SQL' button to display the sql code box. Enter the following....
SELECT `march$`.* FROM `C:\JUNK\123`.`march$` `march$`
union all
SELECT `april$`.* from `C:\JUNK\123`.`april$` `april$`

[may be easier to select the march worksheet into the query an click on
the " * " so all the correct file and worksheet addressing is set up for
you .. then edit the sql to the above format]

The data returned by the query will be all the rows in the March and
April worksheets combined into a single table that you can use as a
pivot table source.

For some reason unknown to me (using Excel 2003) a 'get external data'
can get the data from 2 other worksheets in the same open spreadsheet
but if you try to create a pivot table directly it will only let you do
it in another spreadsheet with the source spreadsheet closed.

regards
 
Top