+ Reply to Thread
Results 1 to 11 of 11

Thread: Vlookup with Max Return formula

  1. #1
    Registered User
    Join Date
    02-08-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    9

    Vlookup with Max Return formula

    I have a table

    Column A Column B
    A 3
    B 7
    C 2
    A 8
    B 9
    A 11

    Then I have a cell D1 to place any letter... A,B,C... whatever... and then i want a cell to return the MAX number from column B corresponding to what letter i put in D1... and since there are multiple A's, i only want the MAX... so if D1 says A, i need a cell to say 11 since that is the MAX one corresponding to A. I cannot figure out how to set up the formula!

  2. #2
    Valued Forum Contributor
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    1,957

    Re: Vlookup with Max Return forumla?

    Try this:

    =MAX(INDEX((A1:A6=D1)*B1:B6,0))

  3. #3
    Registered User
    Join Date
    02-08-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    9

    Cool Re: Vlookup with Max Return forumla?

    that worked! but is there a way to do it without the INDEX function?
    Last edited by hydraonstimpac; 02-08-2012 at 01:30 PM.

  4. #4
    Valued Forum Contributor Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Excel 2007
    Posts
    685

    Re: Vlookup with Max Return forumla?

    Put this array* formula in D1:

    =MAX(IF(A$1:A$10="A",B$1:B$10))

    You might need to adjust the ranges to suit your real data. Or you can put A in another cell, eg C1, and the formula then becomes:

    =MAX(IF(A$1:A$10=C1,B$1:B$10))

    which can be copied down.

    * An array formula must be confirmed using the key combination of Ctrl-Shift-Enter (CSE) rather than the usual <Enter>. If you do this correctly then Excel will wrap curly braces { } around the formula when viewed in the formula bar, but you must not type these yourself. If you need to edit the formula subsequently, you will need to use CSE again.

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    02-08-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Vlookup with Max Return forumla?

    that worked Pete! thanks! though again is there anyway to do this without the array?

  6. #6
    Valued Forum Contributor
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    1,957

    Re: Vlookup with Max Return forumla?

    If you don't want to use an array function or INDEX the you'd really need a third 'helper' column (say column C) with a formula like:

    =IF(A1=$D$1,B1,0)

    You could then just use =MAX(C1:C6)

    Out of interest, do you have a particular reason for not wanting to use INDEX?

  7. #7
    Registered User
    Join Date
    02-08-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Vlookup with Max Return formula

    its an assignment for school and the professor said "only functions we have used in class" and we didnt use index... or array

  8. #8
    Valued Forum Contributor Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Excel 2007
    Posts
    685

    Re: Vlookup with Max Return formula

    Well, how are we to know which functions you have actually covered in class?

    Pete

  9. #9
    Registered User
    Join Date
    02-08-2012
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Vlookup with Max Return formula

    you dont know... which is why i asked if u could do it another way. basically it has to be done with IF, Vlookup, or MAX... or other basic excel functions.

  10. #10
    Valued Forum Contributor Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Excel 2007
    Posts
    685

    Re: Vlookup with Max Return formula

    Well, my solution did only include MAX and IF, and if you consider VLOOKUP as a basic Excel function then INDEX should also be classed as such.

    Pete

  11. #11
    Valued Forum Contributor
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    1,957

    Re: Vlookup with Max Return formula

    I'm not quite sure what your professor is after - the lookup functions in Excel (VLOOKUP, HLOOKUP, LOOKUP and MATCH) are designed to return a single result, not a range of results that you can apply MAX to. If you want to use MAX conditionally then you either need an array of values or you need a helper column, and with a helper column any use of a lookup function would be redundant.

+ 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