Power Query question - how to append two existing columns to be under 2 other columns?

ExcelOnTheClock

New Member
Joined
Dec 1, 2022
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hello,

How can I get columns 3 and 4 to be below columns 1 and 2?

1701274845766.png


If it's possible to do this without using custom M code, that would be ideal! All good if I have to though.

Thanks in advance for any help!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
You need some custom code
 
Upvote 0
Yes you can do that.
 
Upvote 0
You can indeed create a duplicate table. Here another solution.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    colNames = {{"Column1", "Column2"},{"Column3", "Column4"}},
    FirstTwo = Table.SelectColumns(Source,colNames{0}),
    LastTwo = Table.RenameColumns(Table.SelectColumns(Source,colNames{1}), List.Zip({colNames{1},colNames{0}})),
    result = Table.Combine({FirstTwo,LastTwo})
in
    result


Book1
ABCD
1Column1Column2Column3Column4
2a1d4
3b2e5
4c3f6
5
6
7Column1Column2
8a1
9b2
10c3
11d4
12e5
13f6
Sheet1
 
Upvote 0
You can indeed create a duplicate table. Here another solution.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    colNames = {{"Column1", "Column2"},{"Column3", "Column4"}},
    FirstTwo = Table.SelectColumns(Source,colNames{0}),
    LastTwo = Table.RenameColumns(Table.SelectColumns(Source,colNames{1}), List.Zip({colNames{1},colNames{0}})),
    result = Table.Combine({FirstTwo,LastTwo})
in
    result


Book1
ABCD
1Column1Column2Column3Column4
2a1d4
3b2e5
4c3f6
5
6
7Column1Column2
8a1
9b2
10c3
11d4
12e5
13f6
Sheet1
Okay thank you for the help! I'll give this code a shot too.
 
Upvote 0

Forum statistics

Threads
1,216,126
Messages
6,129,004
Members
449,480
Latest member
yesitisasport

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