+ Reply to Thread
Results 1 to 11 of 11

Extract a number from a text?

  1. #1
    Registered User
    Join Date
    12-29-2007
    Posts
    18

    Question Extract a number from a text?

    Hello folks,

    i need to know how to extract a number from text.
    Column A looks something like this:

    65 25 09-8C St. 35:-
    Text text text
    75 09 73-8C 1595:-
    texttextextextextext
    textextextext
    75 19 73-8C St. 275:-

    I need to extract the price from the different cells... in this example it would be
    "35"
    ""
    "1595"
    ""
    ""
    "275"

    NOTE: Not all the prices have a ":-" at the end, which makes this kinda difficult! Help me

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    If the numbers you are looking for are no more than 4 digits long, then this should work for you, put this in B1 and copy down

    Please Login or Register  to view this content.
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    12-29-2007
    Posts
    18

    =/

    Thanks for your quick reply!
    Unfortunately the numbers can be up to 5 digits!
    And also this dosn't really work

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    Can you post an example of your data, it may be easier to understand exactly what you are trying to achieve and where the formula doesn't work?

    Did it work for any rows?

    To post a zipped example, go to “My Documents” or wherever you have your file stored, right-click and “Send to > Compressed file”, then attach this zipped file to your post.

  5. #5
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373
    Hi,

    Try:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-29-2007
    Posts
    18

    Smile =)

    Ahhh thanks alot man! Works fine!!

  7. #7
    Registered User
    Join Date
    12-29-2007
    Posts
    18

    Wink Another Question ;)

    Hope i can bother you with another question

    =IF(ISNUMBER(FIND(":-";A3));TRIM(RIGHT(SUBSTITUTE(LEFT(A3;FIND(":-";A3)-1);" ";REPT(" ";9));9));"")

    this works very well now, but i would like to modify it...
    Some prices and with :- but the lower prices are in this format:
    12:90
    49:90
    14:50

    Could you add something to the formula that says that IF ":-" can't be found
    that it shall look for ":" and also extract the two following digits like :90?
    Tried it myself, but I'm not good enough at excel

  8. #8
    Valued Forum Contributor
    Join Date
    10-15-2007
    Location
    Home
    MS-Off Ver
    Office 2010, W10
    Posts
    373
    Hi again

    If I understand correctly in

    65 25 09-8C St. 35:-

    you want 35, and in

    65 25 09-8C St. 35:12

    you want 35:12

    If this is correct try:

    =IF(ISNUMBER(FIND(":",A1)),TRIM(RIGHT(SUBSTITUTE(LEFT(A1,FIND(":",A1)-1+3*(MID(A1,1+FIND(":",A1),1)<>"-"))," ",REPT(" ",9)),9)),"")

  9. #9
    Registered User
    Join Date
    12-29-2007
    Posts
    18

    yeay you =D

    Thanks ALOT!
    Works fine!!! =D =D

  10. #10
    Registered User
    Join Date
    03-03-2015
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    13

    Re: Extract a number from a text?

    hello please help I need to extract from one cell to individual cell for each piece of info.

    format eg: date store name name1, state price
    00/00/00 shoprite springfield S1, NJ 67.64

    I would need a cell for each one like date, store name, & price. PLEASE HELP i havebeen stuck on this for over a week. thank you inadvance for any assistance.

  11. #11
    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
    53,048

    Re: Extract a number from a text?

    Hi, welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    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

+ 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