+ Reply to Thread
Results 1 to 15 of 15

Vlookup with additional criteria

  1. #1
    Registered User
    Join Date
    11-10-2009
    Location
    manila, philippines
    MS-Off Ver
    Excel 2007
    Posts
    83

    Vlookup with additional criteria

    Hello again Guys!

    I am here again to ask for a formula: I have two columns. The first column is a set of letters with duplicates. I need to lookup or vlookup the second column but need to look for the last duplicate of the criteria being lookup.

    Example: if i lookup for letter a using vlookup i should be getting the last cell in the column with letter a. So, ther answer should be 9.

    a 3
    b 2
    a 1
    c 6
    c 8
    d 5
    a 9


    I hope my example is clear.

    Please help...

    Thanks!

  2. #2
    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,492

    Re: Vlookup with additional criteria

    Not really clear, no. What's being looked up and where? What do you want returning?

    You would probably use an array formula =MAX(IF(... as the search item.

    A sample workbook would be helpful.

    Regards, TMS
    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


  3. #3
    Registered User
    Join Date
    08-17-2012
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    82

    Re: Vlookup with additional criteria

    Quote Originally Posted by TMShucks View Post
    Not really clear, no. What's being looked up and where? What do you want returning?
    I think what he wants to get returned is the data from the duplicate of a specific letter.

    For example if he's searching for "a", he wants to get returned the data 9 and not 3.
    Last edited by FCarv; 09-12-2012 at 01:07 PM.

  4. #4
    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,492

    Re: Vlookup with additional criteria

    If you just want the maximum value:

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

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

    TMS

  5. #5
    Registered User
    Join Date
    08-17-2012
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    82

    Re: Vlookup with additional criteria

    I think it's independently it's value. He wants the second value that would appear in the vlookup.
    Tough vlookup formula only returns the data from the first "a" that locates.

  6. #6
    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,492

    Re: Vlookup with additional criteria

    HTML Code: 

    The formula gives the highest value for the letter in column A: a=9, b=2, c=8, d=5


    Regards, TMS

  7. #7
    Registered User
    Join Date
    11-10-2009
    Location
    manila, philippines
    MS-Off Ver
    Excel 2007
    Posts
    83

    Re: Vlookup with additional criteria [SOLVED]

    Yeah, that's right! This solves my problem. Thanks a lot as always! :D

  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,492

    Re: Vlookup with additional criteria

    You're welcome.

    @FCarv: not sure what your point was? If you got 3, you may not have array-entered the formula.


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


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    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

  9. #9
    Registered User
    Join Date
    08-17-2012
    Location
    Lisbon, Portugal
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    82

    Re: Vlookup with additional criteria

    Quote Originally Posted by TMShucks View Post
    @FCarv: not sure what your point was? If you got 3, you may not have array-entered the formula.
    Nevermind TMShuck, I was not seeing properly the output and therefore thought that was not what coolzero needed.

  10. #10
    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,492

    Re: Vlookup with additional criteria

    @FCarv: no problem, easily done.

  11. #11
    Registered User
    Join Date
    09-18-2012
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Vlookup with additional criteria

    Dear TMS

    The formula and answer you provided seems exactly what I want. However, when I tried, I can only get the max value of the column (see excel file attached), it is not the highest value for each letters in the column. However, when I click into the formula, it looks all right (see jpg files).
    Max-2.JPGMax-1.JPGMax Value.xls
    Please help to solve my problem.

    Regards
    Lynn

  12. #12
    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,492

    Re: Vlookup with additional criteria

    Hello Lynn and welcome to the forum. Asking a question in someone else's thread is considered to be hijacking and against the forum rules.

    For future reference, please start your own thread and provide a reference to another thread if it is particularly relevant.

    In this case, you should note that it is an array formula and must be committed with Ctrl-Shift-Enter rather than just Enter.

    The formula will be confirmed as an array formula in the formula box with curly brackets around. You can't just press F2 to edit the cell and press Enter. You can press F2 and then Cancel without changing the state of the formula.

    Regards, TMS

  13. #13
    Registered User
    Join Date
    09-18-2012
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Vlookup with additional criteria

    I didn't know to reply like this is hacking I am sorry.
    I tried. It works. Thank you very much.

  14. #14
    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,492

    Re: Vlookup with additional criteria

    @Lynn: you're welcome. Not to worry, you know for next time.

  15. #15
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Vlookup with additional criteria

    @ coolzero

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as an infrequent user of the forum, you may have forgotten (or may not be aware) that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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