+ Reply to Thread
Results 1 to 7 of 7

Extract numbers from text string

  1. #1
    Registered User
    Join Date
    11-01-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Extract numbers from text string

    I am trying to write a formula to extract the number from a cell with a text string (containing the number). Besides not knowing how to do this, the complication is that the numbers are not always 4-digits and I don't want the "-n" part of the number. I appreciate anyones help. The attached file "Test1" has example data in sheet 1. The data is in column B and the desired result is in column C.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Extract numbers from text string

    Try this, copied down...
    =LOOKUP(99^99,--("0"&MID(B2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},B2&"0123456789")),ROW($1:$10000)))) Courtesy of:*Ron Coderre
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    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: Extract numbers from text string

    Or

    =MID(B2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},B2&1234567890)),4)+0
    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

  4. #4
    Registered User
    Join Date
    11-01-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Extract numbers from text string

    Thanks AlKey. This worked except I found there are some text strings that had only 2 digits which returned a #value since the 4 digits asked for in formula included letters. Adding the +0 forces it to be a number which didn't like the letter in the equation. If I took the +0 out, it did give me the 4 digits found correctly.

  5. #5
    Registered User
    Join Date
    11-01-2013
    Location
    California, USA
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Extract numbers from text string

    Thanks FDibbins. This did it spot on. Even when I found cells in the array that had only 2 digit numbers. I am impressed that it truncated the text after the 2 digit numbers. Will you explain how this works (for my education)? I don't understand all parts of the formula.

  6. #6
    Registered User
    Join Date
    05-23-2014
    Posts
    43

    Re: Extract numbers from text string

    Hi,

    Please explain this formula, to understand the concept.

    =MID(B2,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},B2&1234567890)),4)+0

  7. #7
    Registered User
    Join Date
    10-09-2014
    Location
    india
    MS-Off Ver
    ms0ffice2007
    Posts
    2

    Re: Extract numbers from text string

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Hi
    I am looking for a way to search all text within each row within one column and find the exact match in another workbook and highlight that cell with respective average. overall and actual date wise.

    I have attached a sample of what I am trying to do.

    Any help would be greatly appreciated as I have drawn a blank here!

    Regard's,
    Arijit
    Attached Files Attached Files

+ 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. Formula to extract numbers from text string
    By ExcelFailure in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-28-2014, 08:06 AM
  2. Extract specific numbers from a string of text
    By Galwaygirl13 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-19-2012, 03:22 PM
  3. extract and sum numbers from a text string
    By Shazwb in forum Excel General
    Replies: 5
    Last Post: 08-28-2011, 09:24 PM
  4. Extract numbers from text string
    By mkvassh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-24-2009, 08:53 AM
  5. [SOLVED] EXTRACT NUMBERS FROM TEXT STRING
    By fiber_doc in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-28-2005, 02:45 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