Forum Discussion

afzalbaharudin's avatar
afzalbaharudin
Copper Contributor
Aug 30, 2022
Solved

Excel Power Query Replace error in one column with values from another column

Hi wonderful community,   I have an Excel table that I loaded to Power Query and I can't figure out how to replace Error values with the value in another column (See snapshot).       Does...
  • SergeiBaklan's avatar
    Aug 31, 2022

    afzalbaharudin 

    As variant

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(
            Source,
            {{"Day", type date}, {"Earl.start", type date}}),
        #"Replaced Value" = Table.ReplaceValue(
            Table.ReplaceErrorValues(#"Changed Type", {{"Day", null }}),
            null,
            each _[Earl.start],
            Replacer.ReplaceValue,{"Day"}),
        DayToDate = Table.TransformColumnTypes(
            #"Replaced Value",{{"Day", type date}})
    in
        DayToDate

Resources