+ Reply to Thread
Results 1 to 7 of 7

adding area code to phone numbers

  1. #1
    Forum Contributor
    Join Date
    10-29-2004
    Posts
    291

    adding area code to phone numbers

    So I have an old spreadsheet with a lot of 7 digit phone numbers in a column (like 555-5555). I need to figure out how to ID all numbers using the ***-**** format and prefacing them with the area code 510 so it adds the area code in front of the number. There are some entries that have different area codes (415, 925, et al) or already have the 510 area code which will need to be ignored.

    How do I accomplish this?

  2. #2
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    If the format is 510-555-5555, you can use =IF(LEN(A1)=12,A1,"510-"&A1)

  3. #3
    Forum Contributor
    Join Date
    10-29-2004
    Posts
    291
    When the value of A1 is zero (where a phone number isn't available) it returns a 510-0. Is there a way it can just leave the field blank if A1 is zero?

  4. #4
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    =if(a1="","",if(len(a1)=12,a1,"510-"&a1))

  5. #5
    Forum Contributor
    Join Date
    10-29-2004
    Posts
    291
    Quote Originally Posted by darkyam
    =if(a1="","",if(len(a1)=12,a1,"510-"&a1))
    Hmmm, still returns a 510-0

  6. #6
    Forum Expert darkyam's Avatar
    Join Date
    03-05-2008
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    2,191
    Is A1 blank or 0? If 0, you'll have to replace "" with 0 in the first part of the formula.

  7. #7
    Forum Contributor
    Join Date
    10-29-2004
    Posts
    291
    Thanks!

+ 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