Forum Discussion

Nivedhana's avatar
Nivedhana
Helper I
2 years ago
Solved

Split Alphanumeric column into 2

We have a column capturing data in below format. Is it possible to split the text and numbers in 2 different columns in power query editor?

 

ABC
1
2

Bhy

3

  •     r = Table.TransformColumns(
            Source, 
            {"ABC", (x) => 
                [num = try Number.From(x) otherwise null,
                txt = if num = null then x else null]}
        ),
        expand = Table.ExpandRecordColumn(r, "ABC", {"num", "txt"})
  • Hi,

     

    Another solution

    = Table.SplitColumn(
    Source,
    "ABC",
    (x) => if Value.Is(x, type number) then {x,null} else {null,x},
    {"Num", "Text"}
    )

    Stéphane 

3 Replies

  •     r = Table.TransformColumns(
            Source, 
            {"ABC", (x) => 
                [num = try Number.From(x) otherwise null,
                txt = if num = null then x else null]}
        ),
        expand = Table.ExpandRecordColumn(r, "ABC", {"num", "txt"})
  • Hi,

     

    Another solution

    = Table.SplitColumn(
    Source,
    "ABC",
    (x) => if Value.Is(x, type number) then {x,null} else {null,x},
    {"Num", "Text"}
    )

    Stéphane