+ Reply to Thread
Results 1 to 16 of 16

extract number from text and number cell

  1. #1
    Registered User
    Join Date
    07-26-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    3

    extract number from text and number cell

    how can i extract only number from a cell containing both number and text.


    sr 521
    sr 25
    sr 5

    I would like to get
    521
    25
    5

    Thanks.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: extract number from text and number cell

    Hi South, welcome to the forum.

    Assuming your numbers are in A1:A10, in B1 use:

    =LOOKUP(99^99,--("0"&MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),ROW($1:$10000))))

    Fill down to B10. Hope that helps!

  3. #3
    Registered User
    Join Date
    07-26-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: extract number from text and number cell

    Thanks Paul.

    But the formula seems to be not working. Perhaps I was not clear with my question. Here is it again.


    sr 521 521
    sr 25 25
    sr 5 5

    In cells A1 to A3, I have characters listed in the left side. In other cells, I would like to get only numbers without sr.

    Thanks.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: extract number from text and number cell

    Maybe try...

    =MID(A1,FIND(" ",A1)+1,LEN(A1))
    HTH
    Regards, Jeff

  5. #5
    Registered User
    Join Date
    07-26-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: extract number from text and number cell

    Thank you HTH. Your formula worked well.

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: extract number from text and number cell

    You're welcome and glad it worked for you

    Please do not forget to mark the thread as solved if this satisfies your query.

  7. #7
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: extract number from text and number cell

    The formula I provided works just fine.

    If cell A1 has "sr 521" and you put my formula into B1, B1 will show: 521

    Same for your other examples. If your data ALWAYS has the text "sr " in front of the number, then a simple MID function like the one jeffrey provided will suffice. Jeffrey's formula works by finding the first space character and returning everything to the right of it. If your text in A1 were "sr bob cat 292", that formula would return "bob cat 292" while mine would still return just 292.

    Note also that the MID formula will return a text (string) result, while mine will return a numeric value. It may or may not make a difference depending on what you're doing with that information.

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: extract number from text and number cell

    Quote Originally Posted by south View Post

    sr 521 521
    sr 25 25
    sr 5 5

    In cells A1 to A3, I have characters listed in the left side. In other cells, I would like to get only numbers without sr.
    H Paul,

    With the second sample the OP posted...

    sr 521 521

    returns 521 with your formula

    I'm guessing the OP wanted 521 521

  9. #9
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: extract number from text and number cell

    My understanding of the question was that those were two different cells.

    "sr 521" in one cell, and the user wanted just the 521 in the cell next to it. Even in the re-phrase after my original post, that's how it appeared to me. Unfortunately the forum doesn't apply spacing to columns well (at all) unless you use the CODE tags. Only the user knows best.

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: extract number from text and number cell

    Yes I see...could be...

    and BTW

    I used your formula and it worked fine as of course you already know

  11. #11
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: extract number from text and number cell

    I bow to others that came up with it and have applied it before me.

  12. #12
    Registered User
    Join Date
    06-19-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    10

    Re: extract number from text and number cell

    Gr8 Paul...your formulae worked for me....thanks a lot

    regards
    misys

  13. #13
    Registered User
    Join Date
    06-19-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    10

    Re: extract number from text and number cell

    paul can u explain me the formulae please...thanks in advance

  14. #14
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: extract number from text and number cell

    Step through it using Evaluate Formula in the ribbon.

    I'd suggest testing on a short alphanumeric string (let's say 10 characters) in A1, and change ROW($1:$10000) to ROW($1:$10), so you can see how it's calculating.

  15. #15
    Registered User
    Join Date
    06-19-2014
    Location
    india
    MS-Off Ver
    2007
    Posts
    10

    Re: extract number from text and number cell

    thanks paul,
    how can i we match multiple columns data AS SHOWN in attachment, here we have multiple columns of 15 with 2000 rows.

    how can we do this with a formulae to match all columns with first column.

    please help me out
    Attached Files Attached Files

  16. #16
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: extract number from text and number cell

    @misys.til

    don't break in with your own question in anotherone's topic.

    it is against the forumrules.

    in that case you have to make a new question and refer to this one.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

+ 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