+ Reply to Thread
Results 1 to 11 of 11

Formula required to add country code to telephone number and remove preceding zero

  1. #1
    Registered User
    Join Date
    09-01-2022
    Location
    Holywell, North Wales
    MS-Off Ver
    Office 365
    Posts
    18

    Formula required to add country code to telephone number and remove preceding zero

    Good morning everyone.

    I'm currently working on a data cleanse and have thousands of contacts where they've put input as a standard phone number e.g 01234 567890.

    I need to change these to +441234 567890 but rather than go through thousands of contacts and manually do it, I'd prefer to output a CSV, add a formula to change these and then re-upload the CSV to make bulk changes.

    Can anybody assist with a formula to do this please?

    So to clarify: I need a formula to remove the preceding 0 and replace it with +44

    Thanks in advance

    Rich

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Formula required to add country code to telephone number and remove preceding zero

    assuming all the numbers before the space will be replaced with +441234, this would work...
    ="+441234"&MID(A2,SEARCH(" ",A2),7)

    Oh, and you may need to replace the commas with semicolons for your formulas?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Registered User
    Join Date
    09-01-2022
    Location
    Holywell, North Wales
    MS-Off Ver
    Office 365
    Posts
    18

    Re: Formula required to add country code to telephone number and remove preceding zero

    Hi Sam.

    The problem is I've got lots of different area codes plus mobile numbers.

    Don't think this is going to be as simple a fix as I initially thought....

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Formula required to add country code to telephone number and remove preceding zero

    possibly uploading a workbook with more samples and expected results.
    after rereading your first post I came up with a shorter version that I wonder if it would work if... all your examples are roughly the same length and it is simply replacing just the 0 with +44... ="+44"&RIGHT(A2,11)

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,914

    Re: Formula required to add country code to telephone number and remove preceding zero

    Try this

    ="+44"&Right(A2,10)

  6. #6
    Registered User
    Join Date
    09-01-2022
    Location
    Holywell, North Wales
    MS-Off Ver
    Office 365
    Posts
    18

    Re: Formula required to add country code to telephone number and remove preceding zero

    Example formats.xlsx

    I've attached a very brief example spreadsheet to show what formats I'm looking for/dealing with.

  7. #7
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,459

    Re: Formula required to add country code to telephone number and remove preceding zero

    Please try and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Formula required to add country code to telephone number and remove preceding zero

    here is your example using the formula I gave you in post #4, seems to return what you want.
    Attached Files Attached Files

  9. #9
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Formula required to add country code to telephone number and remove preceding zero

    Hans' might be easier, however if you want mine, I noticed you have different lengths so this would be my formula adjusted for the length...
    =IF(LEN(A2)=12,"+44"&RIGHT(A2,11),"+44"&RIGHT(A2,10))

  10. #10
    Registered User
    Join Date
    09-01-2022
    Location
    Holywell, North Wales
    MS-Off Ver
    Office 365
    Posts
    18

    Re: Formula required to add country code to telephone number and remove preceding zero

    Brilliant - thanks everyone, that's really helped me out.

  11. #11
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Formula required to add country code to telephone number and remove preceding zero

    if that takes care of your issue, please mark the post as solved using the thread tools dropdown at the top of the post, AND don't forget you can thank any or all of those who've taken the time to help you by clicking on * Add Reputation under their post as that is how we advance on this forum.

+ 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] How to insert telephone country code using ISO code
    By KrishnaR in forum Excel General
    Replies: 5
    Last Post: 08-24-2022, 10:21 AM
  2. 2 letter country code within a string to full country name?
    By berserk539 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-15-2021, 11:17 AM
  3. How do I add country code before phone number?
    By lreddy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-04-2019, 10:38 AM
  4. [SOLVED] Formula to insert text in new column if preceding more than one of the preceding have val
    By aimeecrystalaid in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-04-2013, 11:47 PM
  5. [SOLVED] Country code maping with Caller number
    By naveen4pundir in forum Excel General
    Replies: 3
    Last Post: 04-04-2012, 05:24 AM
  6. Replies: 4
    Last Post: 11-03-2005, 04:30 PM
  7. Replies: 1
    Last Post: 01-27-2005, 12:06 PM

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