+ Reply to Thread
Results 1 to 11 of 11

Mobile Phone Numbers/ Cell Phones

  1. #1
    Registered User
    Join Date
    02-10-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Smile Mobile Phone Numbers/ Cell Phones

    I am desperate for some help on this one. The problem is now accepting numbers starting with zero but it does involve formatting/ masks.

    I have a sheet with many mobile/ cell phone numbers:
    07771123456 for example
    But I need to change this format to drop the "0" and add the country code "44", so need to automate this somehow with a mask/macro.

    07771123456 needs to change to 447771123456 and there is thousand of these so I cant face any more hours of doing it manually, there is a way isnt there? please for my sanity

    I use office 2007.
    Last edited by pdiminski; 02-16-2010 at 02:01 PM.

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Mobile Phone Numbers/ Cell Phones

    if they are all the same length use in another column
    =44&RIGHT(A1,10)
    drag down then copy column paste back special values
    if different lengths then
    =44&MID(A1,2,20)
    should cover it
    Last edited by martindwilson; 02-10-2010 at 12:00 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Valued Forum Contributor khamilton's Avatar
    Join Date
    10-08-2009
    Location
    IL
    MS-Off Ver
    Excel 2007
    Posts
    345

    Re: Mobile Phone Numbers/ Cell Phones

    you could use substitute -->=SUBSTITUTE(A1,0,44) <-- A1 is the old 07771123456 would change it to 44777123456. Is that something you could work with?
    Please acknowledge the response you receive, good or bad. If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Mobile Phone Numbers/ Cell Phones

    kh, the SUBSTITUTE would cause issues if a 0 occurs elsewhere

    Another variation on the theme might be:

    B1: =REPLACE(A1,1,1,44)
    assumes left most char is always a 0

  5. #5
    Valued Forum Contributor khamilton's Avatar
    Join Date
    10-08-2009
    Location
    IL
    MS-Off Ver
    Excel 2007
    Posts
    345

    Re: Mobile Phone Numbers/ Cell Phones

    ahh! very true thanks for pointing that out.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Mobile Phone Numbers/ Cell Phones

    You could just add a 1 to the SUBSTITUTE as optional 4th parameter though...

  7. #7
    Valued Forum Contributor khamilton's Avatar
    Join Date
    10-08-2009
    Location
    IL
    MS-Off Ver
    Excel 2007
    Posts
    345

    Re: Mobile Phone Numbers/ Cell Phones

    yes I just tested it like so--> =SUBSTITUTE(A1,0,44,1)

  8. #8
    Registered User
    Join Date
    02-13-2010
    Location
    Chernivtsy, Ukraine
    MS-Off Ver
    Excel 2002, Excel 2003
    Posts
    6

    Re: Mobile Phone Numbers/ Cell Phones

    SUBSTITUTE is an appropriate approach.

    but you can also use the command "Text to Columns..." in menu Data

    if you choose "fixed width" option, you can separate the first "0" from the rest of the digits.

    then you can join them with "44" with operator "&"

    probably in this case this is not the simplest way, but sometimes for some reasons you can't use formulas, and then this method will help

  9. #9
    Registered User
    Join Date
    02-10-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Mobile Phone Numbers/ Cell Phones

    Perfect many thanks!! legend.

  10. #10
    Registered User
    Join Date
    02-10-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Mobile Phone Numbers/ Cell Phones

    I went down the =SUBSTITUTE(A1,0,44,1) route which worked a dream. Thanks for all your suggestions. There replace functin as mentioned sometimes removed all the "0's".

    Many thanks all.

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Mobile Phone Numbers/ Cell Phones

    I'm glad you've resolved but just to clarify:

    Quote Originally Posted by pdiminski
    There replace functin as mentioned sometimes removed all the "0's"
    The REPLACE Worksheet Function as illustrated would only ever replace the first character of the number... if you were running the Edit -> Replace Tool (via Menus) then yes that would replace all 0's.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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