Brian Dunning's FileMaker Custom Functions

fnPhone ( text )

Phone Number Formatting

  Average rating: 4.2 (39 votes) Log in to vote

Timothy Trimble   Timothy Trimble
Data Design Labs

Share on Facebook Share on Twitter

  Sample input:
  Sample output:
1+(425)555-1212 x55

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Determines the correct structure of a US phone number based on length and if the number starts with a 1.

Will support numbers with structure of :
1 888 555 1212 x943
555 1212
888 555 1212
1 888 555 1212

Anything over 11 chars, with a 1 prefix, will suffix the rest as an extension.
Or, anything over 10 chars, wo a 1 prefix, will suffix the rest as an extension.
Anything less than 7 characters will not get any formatting.

Formatting is structured as:
n+(nnn)nnn-nnnn xnnn



Jean-Pierre Boudreau   Jean-Pierre Boudreau, Montreal QC Canada
Nov 10, 2009
You can replace the substitute function by a Filter function.

Let (pnum = Filter( text; "1234567890") ;

to remove all unwanted character from the input string.
Greg Pering   Greg Pering, Greer, SC
Jan 3, 2010
C'est genial!
Merci, mon pote.
Mark Stratford   Mark Stratford, New Zealand
Oct 15, 2012
Hi I am utilizing the Starting Point Freeware. which has this script

However the phone fields are formatted to suit USA as above.

Is it possiable to get scripting to suit New Zealand, number formatting as follows:

64 06 3425589

64= NZ 06=town /city
3425589= local number.

Your help would be really appreciated

Regards Mark Stratford
maria fritzen   maria fritzen, auckland
Feb 3, 2016
hi there,
i am having exactly the same problem!! how can i get a formatting suitable for new zealand or, even better, an international one?

mark, if you found a solution, could you please email me?, thanks a lot!
thanks, maria

Log in to post comments.


Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 16 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: