Power Query - Combining Transformed Tables within same Excel Workbook

GooberTron

Board Regular
Joined
Oct 13, 2012
Messages
218
Where I have similar table layouts that need transformations within the same Excel file, I'm struggling to see how I can apply the same kind of logic as the "combine files" approach (i.e. transform sample file, apply same steps to subsequent files and then append). Doing the "expand table" approach within the same file just leaves me with a big appended mess that seems impossible to successfully transform afterwards.
This could be similar tables spread across multiple worksheets (e.g. 1 table per worksheet), or today I was presented with 10 identical tables on the same worksheet, just stacked on top of each other separated by 2 blank rows each time.
Having 10 separate queries or simply re-saving the Excel workbook 10 times and manually editing out to 1 table per workbook doesn't feel satisfactory or scalable! Any tips on solving this problem?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Thanks Matt that looks really helpful. I assumed once I had a better understanding of functions I'd be able to do something like this.
How about the weird example of 10 tables stacked on top of each other in a single worksheet? I really need to isolate each table to do the transformations. I'm contemplating writing some VBA to copy each table across to new worksheets one by one.
Can looping through the same worksheet but transforming only one table at a time be done directly in Power Query using functions? Feels like it should be possible. Happy to have a crack at it but want someone to confirm the homework question has a solution before I attempt it!
 
Upvote 0
Power Query identifies the tables by tablename and sheet name. The trick with PQ is to remove any absolute references that will get in your way. So I would filter all objects by type = table, then remove all columns that refer to sheet names. You should then have a unique list of tables regardless of which sheet they are on. I hope I understood correctly
 
Upvote 0
Kicking myself for being dumb now. I'm calling them "tables" colloquially but they weren't setup as proper Excel tables, so this single worksheet just shows as a worksheet in PQ. Ok, quickly convert each of them into real Tables and then I'm good to go. Thanks again Matt. Just started working through Supercharge Power BI too BTW, great book so far!
 
Upvote 0

Forum statistics

Threads
1,223,627
Messages
6,173,420
Members
452,514
Latest member
cjkelly15

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