Closed Thread
Results 1 to 11 of 11

VLOOKUP search from bottom to top ?

Hybrid View

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