Search code examples
excelpowerbipowerquerym

in power Query: How to create conditional column that removes numbers and keeps text


col 1 contains rows that have just numbers and just text. example:

row 1 = 70
row 2 = RS
row 3= abcddkss
row 5 = 5
row 6 = 88

and so on What I want to do is add a column using logic like this: if Col1 not a number then Col1 else null.

what I have so far:

=let mylist=List.RemoveItems(List.Transform({1..126}, each Character.FromNumber(_)),{"0".."9"})
in

if List.Contains(mylist,Text.From([Column1])) then [Column1] else null

however, this will not work for rows that have more than one letter and will only work on ones that have one letter


Solution

  • You can use this:

    if Value.Is(Value.FromText([dat]), type number) then null else [dat]
    

    enter image description here