Pivot Tables Multiple V$ Single data range

shippey121

Well-known Member
Joined
Mar 21, 2006
Messages
1,003
i have a few worksheets that are identical in layout, if i create a pivot table on one data range i can set it out like i want i can select which headings to use in the row or column field and which should be used for data fields, if i use multiple data ranges i get a different layout if i select the layout setup option ive only got a page field a row field a column field and a value field, what im currently doing to reslove this is to copy one range under the other and then run a pivot table on that,

is it possible to set the layout the same as i have when only using one data range ??

TIA
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Yes, Shippey, it is possible.

Assuming the spreadsheet has been saved and for simplicity that each worksheet has data in exactly the same fields. (It need not, it just simplifies the explanation. This is a rough guide to get the answer. In practice, you might do things with a bit more sophisticated.)

Give each data range a defined name. Not dynamic. Say, Table1, Table2, Table3, etc.

Then menu Data, Import External Data, New Database Query. Select the Excel file, then Table1 field/s.

For this one, we won't filter. Or sort. Select the option to view & edit in Microsoft Query before hitting FINISH.

You should see the field/s from Table1 and the first screenful of records.

Now hit the SQL button (or View, SQL) and edit directly in the window to obtain,

SELECT *
FROM don't change this bit.Table1 Table1
UNION ALL
SELECT *
FROM don't change this bit.Table2 Table2
UNION ALL
SELECT *
FROM don't change this bit.Table3 Table3

Where after the first two lines (SELECT * FROM whatever) there are groups of three lines per data range. Each group being of form
UNION ALL
SELECT *
FROM don't change this bit.TableX TableX

You can copy & paste in the SQL window.

When this is done, put the data in Excel via the file menu or the "door" icon on the toolbar. And when the dialog box comes up select "Create a pivot table report..." You might get some error messages but hit cancel and then finish to see the new pivot table. You now have a pivot table with data from the multiple sources. (There are some side effects of this method because of the data query. Main one is if you save the file in a different directory, or rename it. The way we have created it leaves a hard coded address in the SQL and might be a nuisance. Again, this is not a sophisticated example and I am trying to write just enough rather than too much.) HTH, Fazza
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top