Vali Valizada
Vali Valizada

Reputation: 91

Excel, power query merging two columns with a certain condition

Column1|Column2
----------------
blank  |name
blank  |name
number |description
number |description
number |description
blank  |name
blank  |name

This is a tiny structure of my excel power query data-set, so i want to merge these two columns, but only blank cells have to be filled with the second columns' datas, if the first columns have a data, the formula have to skip it.

Upvotes: 0

Views: 1526

Answers (1)

horseyride
horseyride

Reputation: 21298

Add Column .. Custom Column ...

if [Column1] = null then [Column2] else [Column1]

Then remove extra columns

let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Added Custom" = Table.AddColumn(Source, "Custom", each if [Column1] = null then [Column2] else [Column1]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Column1", "Column2"})
in  #"Removed Columns"

Upvotes: 1

Related Questions