+ Reply to Thread
Results 1 to 16 of 16

Extracting Numbers from text

  1. #1
    Registered User
    Join Date
    12-10-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    20

    Extracting Numbers from text

    I have seen another post which is over my head and uses macros to solve a similar problem.

    Here is my problem I need to to solve..

    A1 contains text "12c 1b 3w" or "12c1b3w" or "1c12b3w" or "12 1" or "6c" or "12b" or "7" or can be blank. 1 to 3 sets of numbers, 1 or 2 digits each.

    I would like cell B1 to extract(?) any set (or single) numbers and add them together!

    I am using the below formula and It works fine to get the first set of numbers. But I can't figure out how to get the second or third set of numbers (and better yet add the two together)

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

    Any help without macros? Thank you much in advance.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Extracting Numbers from text

    Please attach a file with sample data and the expected output for better understanding.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    12-10-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Extracting Numbers from text

    Thank you Sixth for your reply.

    PLEASE DON"T USE MY FIRST EXAMPLE !!!

    USE THIS NEW SECOND EXAMPLE !!!

    Thank you
    Attached Files Attached Files
    Last edited by hoventim; 12-10-2012 at 06:01 AM.

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Extracting Numbers from text

    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  5. #5
    Registered User
    Join Date
    12-10-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Extracting Numbers from text

    vlady that was awesome and worked fine for my example!

    But I see now I need to change my example to include two digit numbers also..
    See rows 8 and 9 in my new example.
    Think it can still be done?

    Below info not important to me, just curious about rows

    BTW - when i attempt to manipulate your formula in Row 4, the "{" dissapears from the beginning of your formula and then it doesnt add up correctly?

    And I don't seem to be able to reinsert it properly as in row 5... Why I wonder?

    Thank you vlady
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    12-10-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Extracting Numbers from text

    And I now see I'd like to put an "if" statement in front of your formual and the "{" dissapears and the formula doesnt add all the numbers? ARG... lol

  7. #7
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: Extracting Numbers from text

    Or

    Copy and paste the below formula In D2 cell - Array Formula Requires Ctrl+Shift+Enter instead of Normal Enter

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


    Drag it down...

    For 2007 or higher version - Array Formula Requires Ctrl+Shift+Enter instead of Normal Enter
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by :) Sixthsense :); 12-10-2012 at 05:22 AM.

  8. #8
    Valued Forum Contributor
    Join Date
    10-29-2012
    Location
    Mojokerto,Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    554

    Re: Extracting Numbers from text

    try it (array formula)
    =SUM(IFERROR(MID(A3;ROW($1:$100);1)/1;0))

    copy down

  9. #9
    Registered User
    Join Date
    12-10-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Extracting Numbers from text

    Ghozi thanks.

    Only issue is some of my numbers are two digits long as in "12".
    And it doesn't work on those.

    Also I'd like to nest this in an if statement, can that be done with an array?
    Can you look at my new example? (Example -2)

    Thank you very much

  10. #10
    Registered User
    Join Date
    12-10-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Extracting Numbers from text

    I guess my example didn't include any double digit numbers like 12 or 17.
    There will be no triple digit numbers though. Worked well with my sigle digit example.

    I have included a third example using your formula here with double digits.

    Also I would like to nest this in an if statement. I did it in rows 13 and 14, it seems to work the same way.

    =IF(ISNUMBER(SEARCH(Employee,N7)),"YOUR_ARRAY_FORMULA","")

    Thanks, Tim
    Attached Files Attached Files

  11. #11
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Extracting Numbers from text

    The most versatile way is to use VBa.

    Try this UDF
    Please Login or Register  to view this content.
    Use in worksheet
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Marcol; 12-10-2012 at 10:51 AM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  12. #12
    Registered User
    Join Date
    12-10-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Extracting Numbers from text

    Marcol this works perfectly!

    I will need to school myself on udf instalation and usage. Doesn't look to tuff for this newbie.

    Thank you very much.

  13. #13
    Registered User
    Join Date
    12-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Extracting Numbers from text

    What about if your numbers are formatted in tenths and have ( ) around them? Such as:

    ASDF(2.5); ASDF (3.6); ASDF (5.8)

    Any way to get it to get you the total of the numbers in the same cell in the same format and only the numbers in between the ( )?
    Last edited by mstubbs; 12-10-2012 at 06:35 PM.

  14. #14
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Extracting Numbers from text

    Quote Originally Posted by mstubbs View Post
    What about if your numbers are formatted in tenths and have ( ) around them? Such as:

    ASDF(2.5); ASDF (3.6); ASDF (5.8)

    Any way to get it to get you the total of the numbers in the same cell in the same format and only the numbers in between the ( )?
    Assuming there are no "."s (dots) in the string, other than the decimal points.

    Change the function to this ...
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    12-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Extracting Numbers from text

    Thank you Marcol, I appreciate it. This worked somewhat, the only problem I have now is that I only want the numbers inside the ( ) to be totaled. If I add numbers outside of the ( ) it is still including them in the sum. Any ideas?

  16. #16
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Extracting Numbers from text

    Hi mstubbs

    unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

    I answered your first query in this thread because I felt it was relevant to the OPs' question.

    You are now asking something quite different, and as the OP has marked the thread [SOLVED], better you start your own thread.

    I suggest a title such as "Sum only numbers in brackets in a cell"

    PM me when you have done this and I will post the UDF solution I have waiting for you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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