Page 15 of 15 FirstFirst ... 5131415
Results 141 to 143 of 143

Thread: Extract Only Numbers From Text String

  1. #141
    New Member
    Join Date
    Jul 2018
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Extract Only Numbers From Text String

    Hi,

    This did work. However, it does not cater to cases where in we have decimal values (Float) in the cell. For example: INR0.001. For this, the formula results in 1.
    B1: =SUMPRODUCT(MID(0&A1,LARGE(INDEX(ISNUMBER(--MID(A1,ROW($1:$25),1))*
    ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)

  2. #142
    MrExcel MVP Ron Coderre's Avatar
    Join Date
    Jan 2009
    Location
    Boston, Massachusetts
    Posts
    2,287
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Extract Only Numbers From Text String

    Yes....the assumption in most of the suggested solutions is that the numbers are greater than or equal to zero. Decimal fractions can be an issue. If your example is your typical situation, this regular formula returns the first set of consecutive numbers from the test cell:
    Code:
    B1: =LOOKUP(99^99,--("0"&MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),ROW(1:10000))))
    Something you can work with?
    Best Regards,

    Ron Coderre
    Microsoft MVP-Excel (2006 - 2015)
    Using: Excel 2013 & 2016

  3. #143
    MrExcel MVP
    Moderator
    Peter_SSs's Avatar
    Join Date
    May 2005
    Location
    Macksville, Australia
    Posts
    40,976
    Post Thanks / Like
    Mentioned
    90 Post(s)
    Tagged
    21 Thread(s)

    Default Re: Extract Only Numbers From Text String

    Quote Originally Posted by skhanna View Post
    Hi,

    This did work. However, it does not cater to cases where in we have decimal values (Float) in the cell. For example: INR0.001. For this, the formula results in 1.
    B1: =SUMPRODUCT(MID(0&A1,LARGE(INDEX(ISNUMBER(--MID(A1,ROW($1:$25),1))*
    ROW($1:$25),0),ROW($1:$25))+1,1)*10^ROW($1:$25)/10)
    Welcome to the MrExcel board!

    It would be good to see a slightly larger set of your sample data and expected results as the best/simplest way to get your results may well depend on just how much variation there is in your actual data.
    We can't tell from one example but in the trivial case where all your data was 3 letters followed by a number then the result could be obtained with
    =REPLACE(A1,1,3,"")+0
    Whereas if there could be quite varied text before and/or after the number then a more complex solution may be required.
    Hope this helps, good luck.
    Peter
    Excel 365 - Windows 10
    - Want to help your helpers by posting a small, copyable, screen shot directly in your post? Look here
    - If posting vba code, please use Code Tags - like this [code]Paste code here[/code] - or use the # key in the Reply window
    - Read: Forum Rules, Forum Use Guidelines, & FAQ

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •