Forum Discussion

Mr_Triongl's avatar
Mr_Triongl
Frequent Visitor
3 years ago
Solved

How to validate phone numbers

Hi,   I have a list of phone numbers in my data and want to validate that the numbers are in the correct format - Starting with 01/+44 and 11 digits in total. Anything with less digits or greater t...
  • adudani's avatar
    3 years ago

    hi Mr_Triongl ,

     

    create a new step ( press fx)

     

    paste the following in the formula bar:

     

    = Table.AddColumn(#"Changed Type", "Custom", each if Text.StartsWith([Phone Number],"01",Comparer.OrdinalIgnoreCase) or Text.StartsWith([Phone Number],"+44",Comparer.OrdinalIgnoreCase) and Text.Length([Phone Number])= 11 then "Valid" else "Invalid")

     

    Appreciate a thubs up if this is helpful.

     

    Please accept as the solution if it resolves the question.