Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SamWhite
Frequent Visitor

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:

SamWhite_1-1682519703101.png

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

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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

 

--Nate

View solution in original post

1 REPLY 1
Anonymous
Not applicable

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

 

--Nate

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.