+ Reply to Thread
Results 1 to 10 of 10

max in list that <=input value

  1. #1
    Registered User
    Join Date
    10-07-2011
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    56

    max in list that <=input value

    i am in need of a formula for finding out the max that meets a criteria.

    i've attached the spreadsheet, for an example. what i'm looking to do is have the highlighted cell as an input. based on that input, i'd like to find out the highest number than is associated with that number (sounds confusing to say it this way... but, i need the maximum number that is less than or equal to the input number). from there, i can figure out how and what to use for the vlookup and/or index, match part of things.

    i looked a little at DMAX, which seems like it might work, but, can't get it to do what i want.

    [in the excel attachment, i filled in the values that i want it to say, after the formula is inserted into the cell. in particular, cell A4 is the real concern. i can figure the rest out.]

    thank you, in advance, for any assistance
    Attached Files Attached Files
    Last edited by Apelcius; 11-08-2011 at 10:58 PM.
    --Apelcius--
    Learn. Share. Rinse, Repeat.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: max in list that <=input value

    How about?

    =LOOKUP(units,$C$2:$C$31,$B$2:$B$31)
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: max in list that <=input value

    =MAX(IF($C$2:$C$31<units,$C$2:$C$31))

    Array entered with Ctrl-Shift-Enter rather than just Enter.

    It will be confirmed with curly brackets, thus:

    {=MAX(IF($C$2:$C$31<units,$C$2:$C$31))}


    and:

    =INDEX($B$2:$B$31,MATCH(MAX(IF($C$2:$C$31<units,$C$2:$C$31)),$C$2:$C$31,0))

    Again, array entered with Ctrl-Shift-Enter rather than just Enter.



    Regards
    Last edited by TMS; 11-07-2011 at 05:40 PM.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    10-07-2011
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: max in list that <=input value

    nice! gimme a few to see which one fits the application the best

  5. #5
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: max in list that <=input value

    =INDEX($B$2:$C$31,MATCH(units,$C$2:$C$31,1),1)
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  6. #6
    Registered User
    Join Date
    10-07-2011
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: max in list that <=input value

    ok... TMShucks... I'm afraid that is a little over my head at the moment, as to how that works, and therefore how to apply it.

    NBVC: that works perfectly, and extremely easy for my wee mind to get. thanks to both of you, though, since i will be looking into Shuck's way too.

  7. #7
    Registered User
    Join Date
    10-07-2011
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: max in list that <=input value

    AND will look into davegugg's way as well lol... thanks to all !!!

    {it seems as though i was really close to davegugg's way, but i missed the match type 1, and put type 0 instead. so, was getting an error}
    Last edited by Apelcius; 11-07-2011 at 06:00 PM.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: max in list that <=input value

    Fair comment ... good to have choices though

    See the attached example for a comparison.


    Thanks for the rep.
    Attached Files Attached Files

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: max in list that <=input value

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  10. #10
    Registered User
    Join Date
    10-07-2011
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2010
    Posts
    56

    Re: max in list that <=input value

    oops... forgot to mark solved... sorry bout that :/

+ 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