+ Reply to Thread
Results 1 to 9 of 9

Proper Phone Numbers Based on Country Code

  1. #1
    Registered User
    Join Date
    04-03-2014
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    44

    Proper Phone Numbers Based on Country Code

    Hi,

    I looking for excel formula which converts improper phone numbers into proper way based on country & Country code as shown in below or in attachment.

    Country CountryCode PhoneNumber Result (I expect)
    Algeria +213 +21321240686 213-21240686
    Angola +244 +244222311561 244-222311561
    Argentina +54 +1152736000 54-1152736000
    Australia +61 +61294286555 61-294286555
    Austria +43 +43073290610 43-073290610
    Japan +81 +81426466724 81-426466724
    Bahrain +973 +17228446 973-17228446
    Belgium +32 +3222024111 32-22024111
    Brazil +55 +555134807200 55-5134807200
    Romania +40 +4032537222 40-32537222


    Note: If country code is doesn't exist it should add automatically matching with country.

    Can anyone please me with this?

    Thanks & Regards,
    Mohan
    Attached Images Attached Images

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Proper Phone Numbers Based on Country Code

    Where C2 is the Phone Number and B2 is the Country Code

    EDIT: This works.
    =RIGHT(LEFT(C2,LEN(B2))&"-"&RIGHT(C2,LEN(C2)-LEN(B2)),LEN(C2))
    Last edited by Speshul; 10-24-2014 at 02:34 PM.
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

  3. #3
    Registered User
    Join Date
    04-03-2014
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Proper Phone Numbers Based on Country Code

    Hi Speshul,

    I doesn't work properly, please check Argentina & Bahrain country it doesn't include country code at beginning. The result I expect if phone number contains country code it should divide with "-" and if phone number doesn't include country code at beginning of phone number then it has to include country code.

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Proper Phone Numbers Based on Country Code

    Maybe this

    in D2 and copy down

    =SUBSTITUTE(REPLACE(C2,LEN(B2)+1,,"-"),"+","")

    Row\Col
    A
    B
    C
    D
    1
    Country Code Phone Number Result
    2
    Algeria +213 +21321240686 213-21240686
    3
    Angola +244 +244222311561 244-222311561
    4
    Austria +43 +43073290610 43-073290610
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  5. #5
    Registered User
    Join Date
    04-03-2014
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Proper Phone Numbers Based on Country Code

    Hi Alkey,

    Thanks for reply but It doesn't work properly, please check Argentina & Bahrain country it doesn't include country code at beginning. The result I expect if phone number contains country code it should divide with "-" and if phone number doesn't include country code at beginning then it has to include country code.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Proper Phone Numbers Based on Country Code

    Add a helper column E and in it type =IF(ISERROR(FIND(B2,C2,1)),0,1) and copy down.
    In Column F type =IF(E2=1,MID(B2,2,LEN(B2)-1)&"-"&RIGHT(C2,LEN(C2)-LEN(B2)),MID(B2,2,LEN(B2)-1)&"-"&RIGHT(C2,LEN(C2)-1))
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Proper Phone Numbers Based on Country Code

    Try it now

    =IF(B2=LEFT(C2,LEN(B2)),SUBSTITUTE(REPLACE(C2,LEN(B2)+1,,"-"),"+",""),SUBSTITUTE(B2&"-"&RIGHT(C2,LEN(C2)-1),"+",""))


    Row\Col
    A
    B
    C
    D
    1
    Country Code Phone Number Result
    2
    Algeria +213 +21321240686 213-21240686
    3
    Angola +244 +244222311561 244-222311561
    4
    Austria +43 +43073290610 43-073290610
    5
    Argentina +54 +1152736000 54-1152736000
    6
    Bahrain +973 +17228446 973-17228446

  8. #8
    Registered User
    Join Date
    04-03-2014
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    44

    Re: Proper Phone Numbers Based on Country Code

    It works Mr.Alkey, Thanks a lot!!!

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,893

    Re: Proper Phone Numbers Based on Country Code

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

    BTW: Did you test my solution also?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Convert country words into proper name
    By ka_poroy in forum Excel General
    Replies: 4
    Last Post: 11-18-2013, 03:58 PM
  2. [SOLVED] Adding country codes to a phone number... Please help
    By percyth1 in forum Excel General
    Replies: 1
    Last Post: 03-08-2012, 10:38 PM
  3. GPS coordinates based on ZIP code & country
    By snb in forum Tips and Tutorials
    Replies: 0
    Last Post: 01-06-2011, 11:37 AM
  4. adding area code to phone numbers
    By djarcadian in forum Excel General
    Replies: 6
    Last Post: 04-09-2008, 03:18 PM
  5. Inserting country code "1" into an existing column of phone numbers
    By Snowyky in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 03-18-2008, 06:06 PM

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