Power query with variable source data

Excelnewie

New Member
Joined
Nov 13, 2017
Messages
26
Office Version
  1. 2016
Platform
  1. Windows
Hi all,
Hoping someone can help:

I am trying to set up a 'template' that will clean monthly spreadsheets.

I get a spreadsheet from an external source with almost 300 columns each month. I only need about 20 of these columns. Unfortunately, depending on who sends me the spreadsheet, the columns are not always in the same order, despite having the same names. 3 of these columns contain figures from the previous three months, hence these column names regularly change (month names).

I can create a query extracting columns based on name OR position, but not both.

Any suggestions on how I can do this?

Thanks in advance.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I would use Table.ColumnNames to obtain a list of the column names. You can then create a list of column names that you require - this can then be included as a parameter in: Table.ReorderColumns(table as table, columnOrder as list, optional missingField as nullable number) which will then give you a standardised table.

To manipulate the list of column names use the List functions.

Not a great answer, but it should provide a route to your solution.

Regards
 
Upvote 0

Forum statistics

Threads
1,223,690
Messages
6,173,847
Members
452,535
Latest member
berdex

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