+ Reply to Thread
Results 1 to 10 of 10

Thread: max in list that <=input value

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

    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 09:58 PM.
    --Apelcius--
    Learn. Share. Rinse, Repeat.

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

    Re: max in list that <=input value

    How about?

    =LOOKUP(units,$C$2:$C$31,$B$2:$B$31)
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,222

    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 TMShucks; 11-07-2011 at 04:40 PM.

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

    Re: max in list that <=input value

    nice! gimme a few to see which one fits the application the best
    --Apelcius--
    Learn. Share. Rinse, Repeat.

  5. #5
    Forum Guru davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2007
    Posts
    1,879

    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 2007
    Posts
    48

    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.
    --Apelcius--
    Learn. Share. Rinse, Repeat.

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

    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 05:00 PM.
    --Apelcius--
    Learn. Share. Rinse, Repeat.

  8. #8
    Forum Guru TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,222

    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 TMShucks's Avatar
    Join Date
    07-15-2010
    Location
    Manchester, England
    MS-Off Ver
    MSO 2003 & 2007
    Posts
    6,222

    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 2007
    Posts
    48

    Re: max in list that <=input value

    oops... forgot to mark solved... sorry bout that :/
    --Apelcius--
    Learn. Share. Rinse, Repeat.

+ 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.2.0