Power Query - Promot Headers except the first two columns

Omer_K

Board Regular
Joined
Apr 9, 2017
Messages
124
Office Version
  1. 365
Hello everyone,
I have several files that I group using Power Query,
The problem is, the first two columns have their title in place while the other columns I have to promote the first row as a title ..
I did not find any option to promote only some of the columns ..
Any Ideas?
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
You can't promote some of the columns. You could do the whole first row and then rename the first two columns?
 
Upvote 0
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    tcn2 = List.FirstN(Table.ColumnNames(Source),2),
    tcnlast = List.Skip(Record.ToList(Source{0}),2),
    Result = Table.FromRows(List.Skip(Table.ToRows(Source),1),tcn2 & tcnlast)
in
    Result

Book1
ABCDEFGHIJKLMNOP
1Col1Col2Column3Column4Column5Column6Column7Col1Col2Col3Col4Col5Col6Col7
2Col3Col4Col5Col6Col73022241239291
330222412392912728402132623
427284021326231142373235938
511423732359381725413361016
61725413361016414151921188
741415192118820534367313
820534367313
9
Sheet2
 
Upvote 0
along the same idea of @JGordon11
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="data"]}[Content],
    RenamePartial = Table.RenameColumns(Source, List.Zip( {List.Skip(Table.ColumnNames(Source),2), List.Skip(Record.ToList(Source{0}),2)} )),
    RemoveRow1 = Table.Skip(RenamePartial,1)
in
    RemoveRow1
 
Upvote 0

Forum statistics

Threads
1,216,759
Messages
6,132,548
Members
449,735
Latest member
Gary_M

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