Forum Discussion
tmyasoutov
3 years agoFrequent Visitor
How to extract/clean up numbers from column value. Same column!
Hey everyone! One column in Power Query has two types of values: A 73 digit and a 8 digit values. End result must be 8 digit, 10016711 and 10016709. How to extract or clean up the 73...
- 3 years ago
Thanks for the info, here is my suggestion for the output, would love to see others alternatives.
test is the column name I was trying
steps
- checking if string starts with "PO"
- if True I do two RemoveRange, one for removing the first 4 chars "PO: "
- second the rest of the chars after the 8th number of what you want
- i use the Lenght to get numbers of string subtracting the "PO: 12345678"
I created a Custom Column on PowerQuery, but you can also add this directly on Source
if Text.StartsWith([test], "PO") then Text.RemoveRange( (Text.RemoveRange(Text.From([test]),0,4)), 8, Text.Length([test])-12 ) else [test]Please check if works, hope it was helpful.
Regards,
Douglas.
dcrosseto
Resolver II
3 years agoThanks for the info, here is my suggestion for the output, would love to see others alternatives.
test is the column name I was trying
steps
- checking if string starts with "PO"
- if True I do two RemoveRange, one for removing the first 4 chars "PO: "
- second the rest of the chars after the 8th number of what you want
- i use the Lenght to get numbers of string subtracting the "PO: 12345678"
I created a Custom Column on PowerQuery, but you can also add this directly on Source
if Text.StartsWith([test], "PO")
then Text.RemoveRange(
(Text.RemoveRange(Text.From([test]),0,4)),
8, Text.Length([test])-12
)
else [test]
Please check if works, hope it was helpful.
Regards,
Douglas.