+ Reply to Thread
Results 1 to 8 of 8

VLOOKUP - how to get last found matching value??

  1. #1
    Registered User
    Join Date
    06-19-2008
    Posts
    63

    VLOOKUP - how to get last found matching value??

    I am trying to find out a way for VLOOKUP to return the specified value of a match, but the thing is, the match is listed more than once in the first column.

    example:

    ........A........B........C................H...............J
    1.....MIKE....7........99............JOHN .........In J1, I would put =VLOOKUP(H1,A1:C6,3,FALSE)
    2.....JOHN....8.......77
    3.....DAN.....15......65
    4.....RON.....11......44
    5.....JOHN....12.....39
    6.....ERIC.....8.......39
    7....JOHN....17.......45


    With the exact match, the formula should return '77'. What would I do if I wanted it to return the value in the third column for the 'JOHN' listed? I am going to continue to add names, going down the first column, so I would want the number for the last time I entered the name.

    Is there a function that can start from the bottom and look up?

    Or a formula that can start at specified point and work up? The specific point could be something that I would never reach, like row 3000, and that could guarantee I found the last one listed.

    PLEASE HELP!!!

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

    =LOOKUP(2,1/($A$2:$A$3000=H1),$C$2:$C$3000)
    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
    Registered User
    Join Date
    06-19-2008
    Posts
    63
    that works great!

    Can I ask, what does the '2,1/' mean in the beginning of the equation?

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    This part ($A$2:$A$3000=H1) evaluates to an array of TRUEs/FALSEs. 1 divided be each of these evaluates to an array of 1's and #DIV/0! errors (because 1/True is like 1/1, which equals 1 and 1/False is like 1/0 which results in an error.

    The Lookup() function looks for the last entry that is less than or equal to the Lookup value... so looking for a 2 in an array of 1's and #DIV/0!'s will result in returning the last 1 in the array.... This is then matched to the Result Vector; C2:C3000 to pull the coinciding value..

  5. #5
    Registered User
    Join Date
    01-10-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: VLOOKUP - how to get last found matching value??

    i am 5 years to late
    vlookup with a 3 as the last perameter instead of the normal false!

  6. #6
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: VLOOKUP - how to get last found matching value??

    jg, that would not work. In fact, gives a value of 65 in the OP's example.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  7. #7
    Registered User
    Join Date
    01-10-2013
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: VLOOKUP - how to get last found matching value??

    hmm perhaps the 3 in the last perameter only works with numbers as I am currently using it ina spreadsheet I am working on.
    Sorry for the wrong information

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: VLOOKUP - how to get last found matching value??

    vlookup with a 3 that is just the same as putting anything except 0
    but for that to work you need to sort in ascending order
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ 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