Update phone number format

This post is a quick adaptation to phone number based on the method presented in the add a space to postal code (splitByLength and Merge function).

In this example we will use US and Canadian phone number format which is the following 123 456 7890

  1. First invoke the transform windows (in Edit cells > Transform...)
  2. Then key the following expression:

splitByLengths(value, 3,3,4)[0], + ' '+ splitByLengths(value, 3,3,4)[1]+' '+splitByLengths(value, 3,3,4)[2]

In this case we split the string into three legs of three, three and four characters and display them the one after the other with a space between each one of them. Using the merge function you can change the space to a - or ( ) characters easily.