Merging columns with one master overwriting blank cells

syedn07

New Member
Joined
Jan 24, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have a merged table from power query (full outer). now I have columns AA B C DD EE and lots of null fields.

Now how do I merge the columns but only overwrite blanks from one column and discard if not required.

I need to merge columns 1 and 2. I want to merge the columns so that column 2 is the "master" column and column 1 only fills in the blank cells of column 2.

As the source is dynamic the results also should be dynamic and updated when refreshed.

A1A2B1C1D1D2E1E2
001001bb1cc1dd1dd2ee1ee2
002dd2ee2
003dd2ee2
004bb1cc1dd1ee1
005bb1cc1dd1ee1
006006bb1cc1dd1dd2ee1ee2
007007bb1cc1dd1dd2ee1ee2
008bb1cc1dd2ee1
009009bb1cc1dd1dd2ee1ee2
010dd2ee2

This is how the table looks now got the columns from both lists.

Now I want to merge 1&2s if there two data points, 1 is the priority (A1 overwrites A2, D1 Overwrites D2 etc..)

I have a grasp of excel but am by no means an expert, however, I can learn and figure it out if given the steps.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
These two sentences seem contradictory:

I need to merge columns 1 and 2. I want to merge the columns so that column 2 is the "master" column and column 1 only fills in the blank cells of column 2.
Now I want to merge 1&2s if there two data points, 1 is the priority (A1 overwrites A2, D1 Overwrites D2 etc..)
 
Upvote 0
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    xlst2 = List.RemoveNulls(List.Transform(Table.ColumnNames(Source), each if Text.End(_,1)="1" then null else _)),
    xlst1 = List.Transform(xlst2, each Text.Start(_, Text.Length(_)-1) & "1"),
    xlst = List.Zip({xlst1,xlst2}),
    Cols = List.Transform(xlst, each List.Zip({Table.Column(Source, _{0}), Table.Column(Source,_{1})})),
    Cols1 = List.Transform(Cols, each List.Transform(_, (x)=> if x{0}<> null then x{0} else x{1})),
    tblNoChange = Table.SelectColumns(Source,List.RemoveItems(Table.ColumnNames(Source), xlst1 & xlst2)),
    ColOrder = Table.ColumnNames(Table.SelectColumns(Source,List.RemoveItems(Table.ColumnNames(Source), xlst2))),
    tbl = Table.FromColumns(Table.ToColumns(tblNoChange) & Cols1, Table.ColumnNames(tblNoChange) & xlst1),
    Result = Table.ReorderColumns(tbl, ColOrder)
in
    Result

PQ Column Merge if null.xlsx
ABCDEFGHIJKLMNO
1A1A2B1C1D1D2E1E2A1B1C1D1E1
211bb1cc1dd1dd2ee1ee21bb1cc1dd1ee1
32dd2ee22dd2ee2
43dd2ee23dd2ee2
54bb1cc1dd1ee14bb1cc1dd1ee1
65bb1cc1dd1ee15bb1cc1dd1ee1
766bb1cc1dd1dd2ee1ee26bb1cc1dd1ee1
877bb1cc1dd1dd2ee1ee27bb1cc1dd1ee1
98bb1cc1dd2ee18bb1cc1dd2ee1
1099bb1cc1dd1dd2ee1ee29bb1cc1dd1ee1
1110dd2ee210dd2ee2
12
Sheet2
 
Upvote 0

Forum statistics

Threads
1,215,136
Messages
6,123,246
Members
449,093
Latest member
Vincent Khandagale

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