+ Reply to Thread
Results 1 to 12 of 12

extracting digits only from column with letters and digits

  1. #1
    Registered User
    Join Date
    08-20-2012
    Location
    Sunshine Coast
    MS-Off Ver
    Excel 2007
    Posts
    9

    extracting digits only from column with letters and digits

    I have a column of data (2000 rows) containing both letters and digits eg Newman, "Paul", "0405925621" and I want to get the phone number into a seperate column. Any easy way?

  2. #2
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: extracting digits only from column with letters and digits

    Hi Jayne - here is one way. Assuming your data starts in A1

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

  3. #3
    Registered User
    Join Date
    08-20-2012
    Location
    Sunshine Coast
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: extracting digits only from column with letters and digits

    I entered forumula in column B and copied down the rows and it worked for cells that only had digits, but for the other cells the result is #VALUE!.
    437801005 437801005
    415506645 415506645
    413484212 413484212
    419597411 419597411
    419325860 419325860
    Brown,"Susan","0407505365john" #VALUE!
    Arnott,"John","018916934" #VALUE!

  4. #4
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: extracting digits only from column with letters and digits

    With data in A1:

    =--MID(SUMPRODUCT(--MID("01"&A1,SMALL((ROW($1:$300)-1)*ISNUMBER(-MID("01"&A1,ROW($1:$300),1)),ROW($1:$300))+1,1),10^(300-ROW($1:$300))),2,300)

    This is an array formula that must be entered with CNTRL-SHFT-ENTER rather than just the ENTER key

    So if A1 contains:
    qwerty1234.qwe12*
    the formula will return:
    1234.12
    Gary's Student

  5. #5
    Forum Contributor day92's Avatar
    Join Date
    04-20-2010
    Location
    Los Angeles
    MS-Off Ver
    Excel 360
    Posts
    600

    Re: extracting digits only from column with letters and digits

    Ok give this a try..

    =LOOKUP(99^99,--(MID($A1,MATCH(TRUE,INDEX((--MID($A1,ROW($1:$255),2))>9,0),0),ROW($1:$255))))

  6. #6
    Registered User
    Join Date
    08-20-2012
    Location
    Sunshine Coast
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: extracting digits only from column with letters and digits

    Thanks Jakobshavn, but showing my ignorance here. If I copy and paste the formula into the cell in column B1, 'how' do I ENTER it with CNTRL-SHFT-ENTER?

    ---------- Post added at 10:23 AM ---------- Previous post was at 10:21 AM ----------

    Thanks heaps day92. This worked for most of the cells. The only cells it didn't work for were those that had spaces in the phone number eg.
    Dee,"Claire","0437 821 859" 437
    There aren't too many of them out of the 2,300 so I can do them manually if needed.

    ---------- Post added at 10:29 AM ---------- Previous post was at 10:23 AM ----------

    Actually, one other thing - when I used day92 LOOKUP formula, the results ignored the 0 at the start of the number eg
    Jarrel,"Peta","0407140396" 407140396

    Is there someway I can either bring that into the formula OR an easy way to add it to the result in column B?
    Perhaps I do need to understand how to do Jakobshavn array formula to get the best result?

  7. #7
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: extracting digits only from column with letters and digits

    Good question!
    Usually when you type data or formula into a cell, the last key you touch is the ENTER key. To implement an array formula, hold down the CNTRL and SHFT keys and then touch ENTER

  8. #8
    Registered User
    Join Date
    08-20-2012
    Location
    Sunshine Coast
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: extracting digits only from column with letters and digits

    Hi Jakobshavn,
    I've been trying to manually enter the formula so I could hold CNTRL and SHFT when I ENTER, but it is then highlighting the 1 at then end of this sequence ((-MID("01"&A1,ROW($1:$300),1)), as an error. The following is what I manually entered:

    =--MID(SUMPRODUCT(--MID("01"&A1,SMALL((ROW($1:$300)-1)*ISNUMBER(-MID("01"&A1,ROW($1:$300),1)),ROW($1:$300))+1,1),10^(300-ROW($1:$300))),2,300)

    Also, is there a way to 'paste' (Ctrl + V) an array formula? I tried holding down Ctrl + Shift, then V but that didn't work.

  9. #9
    Registered User
    Join Date
    08-20-2012
    Location
    Sunshine Coast
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: extracting digits only from column with letters and digits

    Hey - got the array forumla to work! THANK YOU.
    One last question though. The result is still ignoring the 0 at the start of the number. Now that I have all the digits (without the 0) in column B, is there an easy way to ADD the digit 0 to the beginning of every number in column B?

  10. #10
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: extracting digits only from column with letters and digits

    If you wish to retain one (or more) leading zeros, remove the double minus at the beginning of the formula.

  11. #11
    Registered User
    Join Date
    08-20-2012
    Location
    Sunshine Coast
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: extracting digits only from column with letters and digits

    Awesome - everything working. Thank you so much.

  12. #12
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: extracting digits only from column with letters and digits

    If you are satisfied with the solution(s) provided, please remember to mark your thread as Solved.

    New quick method:
    Select Thread Tools (above first post on page) -> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word "Title" you will see a dropdown with the words "No prefix".
    Change to "Solved"
    Click Save

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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