Forum Discussion

SamWhite's avatar
SamWhite
Frequent Visitor
3 years ago
Solved

Extract substring from a string with random position

I have a excel column from which I need to extract XYZ12345671, XYZ12389782 and XYZ12389893 which can occur anywhere in the column like below:

How can I accomplish this using Power Query. I want to extract it to a new column. The pattern is XYZ followed by 8 numbers

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    = Table.AddColumn(PriorStepOrTableName, "ID", each Text.Range([Details], Text.PositionOf([Details], "XYZ"), 11))

     

    --Nate

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    = Table.AddColumn(PriorStepOrTableName, "ID", each Text.Range([Details], Text.PositionOf([Details], "XYZ"), 11))

     

    --Nate