+ Reply to Thread
Results 1 to 8 of 8

Search numbers in a text string, find largest "value" return a value

  1. #1
    Registered User
    Join Date
    02-26-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    4

    Search numbers in a text string, find largest "value" return a value

    Ok,
    Real World Explain:
    I have searched and searched for a solution. I am dealing with a string of mineral ownership of land output as text from proprietary system. Sections in a township and range are approx 640 acres. The acres that make up a lease are to the direct left of the approx 640 acres, as is the % ownership. I want the acres to the left of the largest value.

    Pseudo Code:
    Search alphanumeric text field for the largest number (usually around 640), return the value, decimal and all to the left of the slash of the largest value (usually around 640).

    Examples:
    Fields can vary a lot. And values can be twice 640, cuz maybe you are dealing with two sections, so 1,280 acres.

    1/2 x 151.1112/643.9502 x 3/16 answer is 151.1112
    1/2 x 5.0033/643.9502 x 1/4 answer is 5.0033
    1/2 x 40/100 x 1/2 x 3/640.5661 x 1/4 answer is 3
    1/2 x 72.091/1,276.1256 x 1/4 answer is 72.091 (rarely happens, but it does)

    First post ever, apologies if I didn't follow any forum rules correctly.

    Thank you
    Attached Files Attached Files
    Last edited by OilGasKing; 02-27-2013 at 04:41 PM. Reason: Need to add xls file

  2. #2
    Valued Forum Contributor
    Join Date
    07-27-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    826

    Re: Search numbers in a text string, find largest "value" return a value

    OilGasKing,

    Welcome to the forum.

    Can you please upload a small sample workbook - even one which just includes the information above would be fine - so we can see how your data is laid out ("1/2 x 151.1112/643.9502 x 3/16" could be in one or many cells, for example, and the solution may depend on how your data is arranged.)
    Brendan.


    __________________________________________________________________________________________________
    Things to consider:

    1) You can thank any poster by clicking the * at the left of a helpful post.
    2) You can help to keep the forum tidy by marking your thread as "Solved", if it has been answered to your satisfaction.
    3) Help us to help you, by uploading a sample workbook, showing the type of data you're dealing with, and clearly indicating what the results should be.

  3. #3
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Search numbers in a text string, find largest "value" return a value

    Hi,

    Attached is your solution. Hope this helps.
    Attached Files Attached Files
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  4. #4
    Registered User
    Join Date
    02-26-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Search numbers in a text string, find largest "value" return a value

    Quote Originally Posted by xlbiznes View Post
    Hi,

    Attached is your solution. Hope this helps.
    Xlbizness,

    Thank you for being so quick. My apologies if I ask (and apologize at the same time for not saying it earlier) can this be done through functions and formulas only? My coworkers won't be able to do macros.

    Thank you

  5. #5
    Registered User
    Join Date
    02-26-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Search numbers in a text string, find largest "value" return a value

    Quote Originally Posted by OilGasKing View Post
    Xlbizness,

    Thank you for being so quick. My apologies if I ask (and apologize at the same time for not saying it earlier) can this be done through functions and formulas only? My coworkers won't be able to do macros.

    Thank you
    Also I've added some other real world examples to the solution. I am getting some #VALUE! returns. So while my cover is that my coworkers can't use macros, I can't either I guess. Which is why I'm looking for function solution.

    Thank you
    Attached Files Attached Files

  6. #6
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Search numbers in a text string, find largest "value" return a value

    Using your first posted workbook, this regular formula pulls the last number before the last slash (/)
    Please Login or Register  to view this content.
    Copy that formula down as far as you need.

    With your sample data, these are the returned values:
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  7. #7
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Search numbers in a text string, find largest "value" return a value

    @Ron,

    My 20 lines of code for just 1 line of yours. Coding and time optimized. That's Great.

  8. #8
    Registered User
    Join Date
    02-26-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Search numbers in a text string, find largest "value" return a value

    Ron,

    You did what others told me I couldn't do without a macro. Wow. I am completely happy and moving forward. For academic thought, it worked 142 out of 145 times flawlessly. It got tripped out by:

    1.00000000 X 0.10000000 X 1/2 x (1/4 x 3/16) x 120.0538
    /640.5661

    0.90000000 X 1/2 x (1/4 x 3/16) x 120.0538/640.5661

    But I'm happy as a clam, so no worries.
    1/2 x (1/5 - (1/4 x 3/16)) x 120.0538/640.5661

    Thank you!

+ 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