Closed Thread
Results 1 to 11 of 11

VLOOKUP search from bottom to top ?

  1. #1
    Registered User
    Join Date
    06-04-2007
    Posts
    8

    Question VLOOKUP search from bottom to top ?

    Is there any way to force VLOOKUP to search data from the current row up to the top row?
    Normally VLOOKUP will search data from top to bottom, right? But when I have a long list of data and I want to get the latest data, I can't use VLOOKUP because it always fetch the first one, not the latest one. Is there any way to fix this problem?

    Thanks,

  2. #2
    Forum Contributor WinteE's Avatar
    Join Date
    04-07-2007
    Location
    Netherlands
    Posts
    544
    What do you mean with "current row" ?
    Just keep it simple !


    http://www.excelguide.eu
    In English as well as in Dutch

  3. #3
    Forum Contributor
    Join Date
    01-05-2004
    Location
    Helsinki, Finland
    Posts
    100
    Hi,

    here is an example of kind of "reverse vlookup". It returns data from the last row that matches the criteria.

    In D2, you can change the value you are looking for from the A column and in E2 it returns a number from volumn B. This is done with normal VLOOKUP.

    In G2:H2 is the same thing, but with an array formula that returns the last match:

    {=INDEX(B2:B22,MAX(ROW(A2:A22)*(G2=A2:A22))-1)}

    Is this what you are looking for? If you need more info about the formula, just ask.

    - Asser
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-04-2007
    Posts
    8

    Thumbs up

    Thank Jazzer, yes that is what I'm looking for, but I'm not quite understand how it work. As you can see in the file I attached. I edited something in your file and then it gave me an error. I'm not sure what I'm doing wrong.
    Attached Files Attached Files

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Jazzer's suggested formula is an "array formula", as he says.

    You need to confirm the formula with CTRL+SHIFT+ENTER so that the curly braces appear automatically around the formula in the formula bar. To do this select H2 press F2 and then hold down CTRL and SHIFT keys while pressing enter.

    You could use an alternative formula which is just "normally entered" - in H2 copied down

    =LOOKUP(2,1/(A$2:A$22=G2),B$2:B$22)

  6. #6
    Forum Contributor
    Join Date
    01-05-2004
    Location
    Helsinki, Finland
    Posts
    100
    Quote Originally Posted by daddylonglegs
    =LOOKUP(2,1/(A$2:A$22=G2),B$2:B$22)
    That is a brilliant formula! Thank's daddylonglegs.

    And for KASTEO: Yes, it's an array formula (well not that one). Array formulas are one quite powerfull feature in Excel. You can learn more about them for example from here or here.
    - Asser

  7. #7
    Registered User
    Join Date
    06-04-2007
    Posts
    8

    Talking

    Ahh... I got it now. Both are work wonderfully.

    Thank you,
    Kongkeat K.

  8. #8
    Registered User
    Join Date
    05-03-2007
    MS-Off Ver
    2016
    Posts
    37
    i hope it's ok with the OP to post here a question about getting vlookup to start from the bottom up, since it's the same topic and i don't want to create a new thread when there's an existing one already.

    i've been trying to get daddylonglegs' post to work on an excel sheet i'm working on but i can't seem to make it work. here are the details on the sheet:

    -let's say current row is 2736
    -agent's name is in column G, agent's current stage is in column O, and agent's past stage is in column Y
    -agent's current stage is just +1 to past stage for every week it: example - mike's stage last week ending march 21 was stage 1 so if mike appeared again in week ending march 28, his previous stage is now listed as stage 1 and current stage is automatically listed as stage 2. rinse, repeat as needed.

    so let's say i'd like to get Y2736 to show agent's past stage based on the last time agent's name appeared, looking from row 2735 up to row 2 (row 1 has the headings)

    thanks!
    "All your Dakar are belong to Pajero" 11 Dakar Rally wins...7 straight since 2001.

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Quote Originally Posted by nugundam93
    i hope it's ok with the OP to post here a question about getting vlookup to start from the bottom up, since it's the same topic and i don't want to create a new thread when there's an existing one already.
    Hello nugundam93

    Unless your contribution might be useful to the poster of this thread (and I don't think it is in this case) you should start a new thread......

  10. #10
    Registered User
    Join Date
    05-25-2012
    Location
    Argentina
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: VLOOKUP search from bottom to top ?

    Quote Originally Posted by Jazzer View Post
    That is a brilliant formula! Thank's daddylonglegs.

    And for KASTEO: Yes, it's an array formula (well not that one). Array formulas are one quite powerfull feature in Excel. You can learn more about them for example from here or here.
    - Asser
    I used the formula, it works great, but i can't understand how it works! Can you pleas explain it?
    Thanks for sharing!

  11. #11
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VLOOKUP search from bottom to top ?

    NitoA,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

Closed 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