+ Reply to Thread
Results 1 to 5 of 5

International and United States custom cell formatting?

  1. #1
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    International and United States custom cell formatting?

    Not sure if being idiotic or just not possible, but I am trying to insert custom formatting into a cell so when I enter a set of 9 numbers for phone numbers in the U.S. and 14 numbers for international phone numbers, it will automatically display it in the correct format. Reason for the 0's on the international is because country codes often start with a 0, so I need to ensure it isn't removed from the number. Any ideas on how one might be able to do this would be appreciative, this one is stumping me.

    United States Format: (###) ###-####
    International Format: 000-000-0000-0000
    Janos S. Vamos
    Data Systems Technician/Fire Controlman PO1(SW/AW)
    US Navy Retired


    Remember, Record Macro can be your friend for figuring out solutions.

    Good or Bad, let me know how I did by clicking on the "Add Reputation" * just to the lower left of here. it only takes a few seconds to let someone know.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: International and United States custom cell formatting?

    Hi Janos,

    To my knowledge you can't do this with number formats. You could transfer the results via a formula into another column, e.g.

    =IF(LEN(A1)=9,"("&LEFT(A1,3)&") "&MID(A1,4,3)&"-"&RIGHT(A1,4),LEFT(A1,3)&"-"&MID(A1,5,3)&"-"&MID(A1,9,4)&"-"&RIGHT(A1,4))

    Perhaps (if you haven't already done so) this could be combined with some data validation on the input cells to prevent entries of other than 9 or 14 characters.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: International and United States custom cell formatting?

    I may just have to do a conditional macro that will check the value and change it as required. I was just trying to stay away from that as it is the same area I needed for lookups of contacts, new contacts, and updating contacts so I would have to go back through all my current macros and ensure that the hyphens and parenthesis are removed from the values.

  4. #4
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: International and United States custom cell formatting?

    Decided to recode the macros I had to change the cell format based on string length.

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: International and United States custom cell formatting?

    Good. Hope all's ok now.

    Regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1