+ Reply to Thread
Results 1 to 22 of 22

How do I separate text from a phone number in one cell?

  1. #1
    Registered User
    Join Date
    01-04-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2010
    Posts
    23

    How do I separate text from a phone number in one cell?

    I have a 2010 version of MS Excel. I have roughly 10000 cells that I need to separate into two columns from one cell. What's the best way to do this?

    Here is an example of one cell "John Smith 888-8888".

    Thank you in advance.

  2. #2
    Forum Contributor
    Join Date
    11-13-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    464

    Re: How do I separate text from a phone number in one cell?

    Is your intent to have John Smith in one cell and 888-8888 in another or do you just want to eliminate the text or the number?

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: How do I separate text from a phone number in one cell?

    Option: Use TeXt to Columns with space as the delimiter.
    Last edited by protonLeah; 01-12-2014 at 05:46 PM.
    Ben Van Johnson

  4. #4
    Forum Contributor
    Join Date
    11-13-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    464

    Re: How do I separate text from a phone number in one cell?

    Sorry, I reread the original post and answered my own question.

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How do I separate text from a phone number in one cell?

    If the numbers are always the same length...

    A2 = John Smith 888-8888

    To extract the name:

    =LEFT(A2,LEN(A2)-9)

    To extract the number:

    =RIGHT(A2,8)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  6. #6
    Registered User
    Join Date
    01-04-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: How do I separate text from a phone number in one cell?

    The numbers and text vary. I tried to use the right function, but then it leaves the text and the numbers still in the same cell together.

    I need both sets of data - the text and the numbers.
    Last edited by watchoverme; 01-12-2014 at 04:01 AM.

  7. #7
    Forum Contributor
    Join Date
    01-30-2011
    Location
    Vancouver, Canada
    MS-Off Ver
    Excel 2010
    Posts
    604

    Re: How do I separate text from a phone number in one cell?

    provide some sample data

  8. #8
    Registered User
    Join Date
    05-10-2013
    Location
    Pomáz, Hungary
    MS-Off Ver
    Excel 2007
    Posts
    78

    Re: How do I separate text from a phone number in one cell?

    If the string is in A1 and the two parts are separated with one space, enter into B1:

    =LEFT(A1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))-2)

    into C1:

    =TRIM(SUBSTITUTE(A1,B1,""))

  9. #9
    Registered User
    Join Date
    01-04-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: How do I separate text from a phone number in one cell?

    Sample Data as requested:

    Ronald Klein 321-0166
    Calvin Stephens 462-8016
    Russell Summers 475-8820
    Charlotte Stewart 468-2163
    Trevor 329-1171
    Jillian 235-3535

    It is just data with names then telephones. The names vary in length and do have spaces in between some of them.

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: How do I separate text from a phone number in one cell?

    Damn AutoCorrect!!!

    That should be "Text To Column" (not Test to Column).
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  11. #11
    Registered User
    Join Date
    01-04-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: How do I separate text from a phone number in one cell?

    Haha. I know what you meant. Unforuntaely, I'm not able to use text to columns because I don't have any unique characters separating the text with the numbers except for the space, but I have many cells with multiple spaces.

  12. #12
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: How do I separate text from a phone number in one cell?

    =TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",100)),100))
    Try this formula, the result is the text from last space to the end.
    Willem
    English is not my native language sorry for errors
    Please correct me if I'm completely wrong

  13. #13
    Registered User
    Join Date
    01-04-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: How do I separate text from a phone number in one cell?

    Quote Originally Posted by popipipo View Post
    =TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",100)),100))
    Try this formula, the result is the text from last space to the end.
    I pasted the formula exactly as is to the right of my column and a FALSE displayed.

  14. #14
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: How do I separate text from a phone number in one cell?

    Here my sample workbook
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    12-31-2012
    Location
    Jhang, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: How do I separate text from a phone number in one cell?

    And some addition to your sample workbook by me

    Quote Originally Posted by popipipo View Post
    Here my sample workbook
    Attached Files Attached Files

  16. #16
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How do I separate text from a phone number in one cell?

    Would this be by chance what you are looking for? I separated the text from the telephone numbers having the text in one column and the telephone number in another column.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  17. #17
    Registered User
    Join Date
    01-04-2012
    Location
    Ontario
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: How do I separate text from a phone number in one cell?

    YES! Genius. Thank you so much. Can you explain to me your formula in excel because I've never encountered TRIM and SUBSTITUTES.

  18. #18
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: How do I separate text from a phone number in one cell?

    Can you explain
    Microsoft does it with F1

  19. #19
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How do I separate text from a phone number in one cell?

    These are the results I get based on your posted sample data using the formulas suggested in post #5:

    Data Range
    A
    B
    C
    2
    Ronald Klein 321-0166
    Ronald Klein
    321-0166
    3
    Calvin Stephens 462-8016
    Calvin Stephens
    462-8016
    4
    Russell Summers 475-8820
    Russell Summers
    475-8820
    5
    Charlotte Stewart 468-2163
    Charlotte Stewart
    468-2163
    6
    Trevor 329-1171
    Trevor
    329-1171
    7
    Jillian 235-3535
    Jillian
    235-3535

  20. #20
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How do I separate text from a phone number in one cell?

    In message #17, who are you referring to for an explanation?

    In case you are referring to my message #16

    The first formula entered in the worksheet was in F1
    =TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",75)),75))

    Look at the formula from the inside outwards. The innermost function is SUBSTITUTE. SUBSTITUTE basically looks at the cell that you want to make substitutions in ( A1) the next argument is what you want to substitute and in this case it is the spaces in the text ( " " ). The following argument is what is going to be the replacement. In this case REPT (repeat) will insert 75 spaces for every space in A1.

    RIGHT has two arguments - what cell and how many characters. The number in A1 has no spaces so is preceded by 75 spaces. So the RIGHT function is now looking at this long string of characters with 75 spaces between the different elements. The last element being the telephone number. The RIGHT function is just taking the last 75 characters which includes the telephone number (8 characters) and a bunch of spaces.

    The TRIM function "trims" away the excess spaces from the ends of the text thus leaving just the telephone number.


    The second formula entered is entered in E1

    =TRIM(SUBSTITUTE(SUBSTITUTE(A1," ",REPT(" ",75)),TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",75)),75)) ," "))

    If you look at the formula, the BOLD part is the first formula inserted into this formula. The second SUBSTITUTE is there to substitute the spaces in A1 with 75 spaces each as in the first formula. The first SUBSTITUTE then takes this very long string and substitutes the bold part of the formula (the telephone number) with a space...the last " " in the formula.

    The TRIM function now removes all excess spaces from the beginning and end of the string and leaves a single space between the remaining elements of the cell.

    I hope that this confusing explanation isn't too confusing to be understood.
    Last edited by newdoverman; 01-12-2014 at 05:55 PM.

  21. #21
    Forum Expert
    Join Date
    12-11-2011
    Location
    Netherlands
    MS-Off Ver
    office 365
    Posts
    3,293

    Re: How do I separate text from a phone number in one cell?

    using the formulas suggested in post #5:
    Post #5, #8, #12, #16 Gives all the same result.

  22. #22
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: How do I separate text from a phone number in one cell?

    The idea behind the formula is this (I think).

    The TRIM function removes all leading and trailing spaces from a text string. It also reduces all double spaces to a single space.
    Using the above information you replace every single space in a string to one that is 75 spaces or some big number.
    Then you use the Right function to take the last 75 characters of this "space padded" string and do a TRIM on it.

    I saw this trick a few years ago from DonkeyOte. It all revolves around knowing how TRIM works.

    I hope this explanation lets you understand what I think is being done in formulas.

    If you use the Evaluate Formula tool you can step through the formula and see it work..

    http://www.officearticles.com/excel/...soft_excel.htm

+ 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. Phone number format in vba text box?
    By aduma in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-04-2015, 12:32 AM
  2. Is it possible to make Excel dial a phone number from my smart phone?
    By D_Step in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-19-2013, 06:11 PM
  3. Extract phone number from text
    By db3712 in forum Excel General
    Replies: 4
    Last Post: 03-14-2013, 11:18 AM
  4. macro required to separate mobile phone no. from landline phone no.s
    By Poseidons-Palace in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2012, 05:10 PM
  5. Extract & Copy a phone number from text
    By alpha.martinez in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-02-2012, 01:47 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