Forum Discussion

agd50's avatar
agd50
Helper V
10 months ago
Solved

Conditional M Code - Removing a whole value from column IF a character is there

I want to remove an entire value if there is a "+" symbol, so it will be blank.

Example: "123+456" - I want this whole value removed (change to null)
How to achieve this in power query?

  • Hi,

    This M code works

    let
        Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
        #"Uppercased Text" = Table.TransformColumns(Source,{{"Data", each if Text.Contains(_,"+") then null else _}})
    in
        #"Uppercased Text"

    Hope this helps.

     

1 Reply

  • Hi,

    This M code works

    let
        Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
        #"Uppercased Text" = Table.TransformColumns(Source,{{"Data", each if Text.Contains(_,"+") then null else _}})
    in
        #"Uppercased Text"

    Hope this helps.