+ Reply to Thread
Results 1 to 4 of 4

Extracting numbers of varying length from a string

  1. #1
    Registered User
    Join Date
    12-13-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Extracting numbers of varying length from a string

    Hi there,

    I have been unable to find a workable solution to this problem elsewhere. I've tried a few different things, but haven't been able to come up with a reliable method.

    I want to extract two numbers from a string into two separate cells, however the length of the numbers can vary each time. The start of the string is always the same i.e. "Solution(" , and the numbers are always separated by a semi colon.

    Solution(9.51; 9.1044)
    Solution(0.08847; 0.06728)
    Solution(5.1826; 215.02)

    Say for example, Solution(9.51; 9.1044) is in A1, I want to extract the number 9.51 into B1, and 9.1044 into C1.

    Any help would be much appreciated
    Last edited by bethj; 12-13-2011 at 02:07 AM.

  2. #2
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Extracting numbers of varying length from a string

    Try,

    B1

    =MID(A1,FIND("(",A1)+1,FIND(";",A1)-FIND("(",A1)-1)+0

    C1,

    =SUBSTITUTE(MID(A1,FIND(";",A1)+1,250),")","")+0

    copy down.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  3. #3
    Registered User
    Join Date
    07-14-2011
    Location
    Ha Noi, Viet Nam
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: Extracting numbers of varying length from a string

    Formula in Cell B1 :
    PHP Code: 
    =--MID(A1;FIND("(";A1)+1;FIND(";";A1)-FIND("(";A1)-1
    Formula in Cell C1 :
    PHP Code: 
    =--MID(A1;FIND(";";A1)+1;LEN(A1)-FIND(";";A1)-1
    NOTE :Format decimal in control panel has to be "," to show results desire with format NUMBER
    Thanks!
    Last edited by sunflowers; 12-13-2011 at 02:33 AM. Reason: add NOTE

  4. #4
    Registered User
    Join Date
    12-13-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Extracting numbers of varying length from a string

    Thank you to you both. Both examples were successful!

    Cheers!

+ 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