+ Reply to Thread
Results 1 to 10 of 10

Phone data

  1. #1
    Registered User
    Join Date
    11-22-2012
    Location
    Brussels, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    2

    Phone data

    Hello,

    I have the following problem, I have a list with the the following type of data:
    FAX : 010/25878596

    I need to keep the following format: 0102587596

    So far I've replaced all the spaces and "FAX :" by nothing but then I only keep the following data: 102587596

    I've tried formatting the data as text but this doesnt seem to work.

    Any ideas?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,422

    Re: Phone data

    =TEXT(SUBSTITUTE(SUBSTITUTE(A1,"/",""),"FAX : ",""),"00000000000")


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Phone data

    hi Jay-d, welcome to the forum. do you mean "01025878596"? if so, try:
    =SUBSTITUTE(SUBSTITUTE(A1,"FAX : ",""),"/","")

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,422

    Re: Phone data

    @benishiryo: I think the OP's problem is that when he is left with just numbers, he loses the leading zero and wishes to retain it. Using TEXT will output a text string and keep all the digits.


    Regards, TMS

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Phone data

    Or you could do this:

    =""&SUBSTITUTE(SUBSTITUTE(A1,"FAX : ",""),"/","")

    Hope this helps.

    Pete

  6. #6
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Phone data

    @TMShucks:
    hmmm but since it's already a text, my formula will not convert it to a number no? hence, the leading "0" is still retained. i might be missing something here. works fine on my side when i tried

  7. #7
    Registered User
    Join Date
    11-22-2012
    Location
    Brussels, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Phone data

    Problem solved the solution of benishiryo worked perfectly.

    Thx!

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,422

    Re: Phone data

    @benishiryo: I thought that was the problem - Excel trying to be helpful and, after taking out the text, saying, "ah, these are all numeric digits, I'll make this a number" ... and then losing the leading zero.

    Whatever, Pete's solution is shorter and will have the same effect as the TEXT option.

    Regards, TMS

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,723

    Re: Phone data

    The problem with using TEXT with a fixed number of digits is that you might get more leading zeros than needed, if the original number is short of digits - the resulting phone number might then get interpreted as an overseas destination (in the UK anyway, where 00 at the beginning of a phone number means it is to an international destination).

    Hope this helps.

    Pete

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,422

    Re: Phone data

    I did count the digits, 11, to match the data sample. In that respect, it should meet the OP's requirements.

    But, as I said, I think your solution works well and is much neater.

    Regards, TMS

+ 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