Renaming a Column

hatstand

Well-known Member
Joined
Mar 17, 2005
Messages
778
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

After I have Promoted headers. One of the columns is renamed with this example '01/08/2020 TO 07/08/2020'. My problem is that every import the column contains a different range of dates so the line below will not work. I know I can't use wildcards, so getting a bit stuck for solution.

'= Table.RenameColumns(#"Filtered Rows2",{{"01/08/2020 TO 07/08/2020", "Period"}})'

Any pointers would be much appreciated.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
  1. use xl2bb
  2. post representative (structure) source data (use generic values if necessary)
  3. post actual M
  4. post expected result from your example
  5. or post a link to the shared excel file with all above using onedrive, googledrive, dropbox or any similar service
then we will see what we can do
 
Last edited:
Upvote 0
If the column is always in the same position you can use Table.ColumnNames to refer to it.

For example if it was the 3rd column you could use this.

'= Table.RenameColumns(#"Filtered Rows2",{{Table.ColumnNames(#"Filtered Rows2"){2}, "Period"}})

Note the columns have a 0-based index, i.e. column 1 index is 0, column 2 index is 1 and so on.
 
Upvote 0
Thanks, that's exactly what I'm after. Very much appreciated.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,211
Members
448,554
Latest member
Gleisner2

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