Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Power Query, Remove 1st 2 characters in string

I have a column of telephone numbers in slightly different formats due to how the agents input them into the database. Some start with a 0 and some with 44 (country code). I have found a code online that has helped me remove the 0’s at the start of the string but now I am trying to adapt this to remove the 44 at the beginning of the string and for some reason, it doesn’t seem to want to play ball.

= Table.TransformColumns(
#"Renamed Columns",
{{
"telephone",
each if Text.Start(Text.From(_),2)="44" 
then 
""&Text.From(_) 
else _ 
}})

Thanks in advance for any assistance

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

This should work

Table.TransformColumns(#"Changed Type",{{"telephone",each if Text.Start(Text.From(_),2)="44" then Text.RemoveRange(Text.From(_),0,2) else _ }})
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading