Using Format Code for User-Defined Formats

Discuss the spreadsheet application
Post Reply
uncouthyouth
Posts: 2
Joined: Mon Jan 21, 2008 6:47 pm

Using Format Code for User-Defined Formats

Post by uncouthyouth »

Hello all,

I would like to know how to use the format code box in the Format dialog under user-defined to specify how to format a telephone number. For example, 5559931693 becomes (555) 993-1693 and so on. Any help would be much appreciated.
huw
Volunteer
Posts: 417
Joined: Wed Nov 21, 2007 1:57 pm

Re: Using Format Code for User-Defined Formats

Post by huw »

Code: Select all

(###) ###-####
although that won't cope with leading zeros.
uncouthyouth
Posts: 2
Joined: Mon Jan 21, 2008 6:47 pm

Re: Using Format Code for User-Defined Formats

Post by uncouthyouth »

Perfect, thank you.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Using Format Code for User-Defined Formats

Post by acknak »

You should think carefully about using a numeric value for telephone numbers: you will never be able to store a number that starts with a 'zero' digit. That may not be a problem (e.g. telephone numbers may be restricted to never start with a zero), but in general, it's unwise to store something that's not a number as a numeric value.

It's also true that if you don't store them as a numeric value, you can't use the format code--you would need a formula to format the number. You have to decide based on your project.
AOO4/LO5 • Linux • Fedora 23
Post Reply