+ Reply to Thread
Results 1 to 9 of 9

Lookup from bottom of range, ignoring bottom n no. of rows

  1. #1
    Registered User
    Join Date
    04-06-2012
    Location
    India
    MS-Off Ver
    Pro Plus 2019
    Posts
    70

    Lookup from bottom of range, ignoring bottom n no. of rows

    Hi!
    I have data in a column range where latest data is continuously added at the bottom of the column. The amount of records i.e. rows which can contain the data is not fixed, so I do not know in advance which row no. would have the latest data.

    I am doing a lookup to match the data from the bottom of the range towards the top (so as to see the most recent result). Formula is as given below:
    =LOOKUP(2,1/($F$1:$F$16=A3),$G$1:$G$16)
    I now need to do a lookup, ignoring the last 5 rows from the range, i.e. most recent result ignoring the last 5 rows in the column. (I think it could be achieved with CountIf but am not able to get it to work).

    Please note: I am specifically looking to ignore only the last 5 rows from the range, not looking for nth result.

    Sample file attached.
    Attached Files Attached Files
    Last edited by naira; 12-05-2018 at 01:38 AM.

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    4,515

    Re: Lookup from bottom of range, ignoring bottom n no. of rows

    Please try

    =LOOKUP(2,1/(F1:INDEX(F1:F16,COUNT(G1:G16)-5)=A3),G1:G16)
    Last edited by Bo_Ry; 12-05-2018 at 01:49 AM. Reason: revise formula

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Business (Win 10 - Work) & MS 365 Subscription Insider (Win 10 - Home)
    Posts
    42,092

    Re: Lookup from bottom of range, ignoring bottom n no. of rows

    Try this:

    =LOOKUP(2,1/(($F$1:$F$16=A3)*(ROW($F$1:$F$16)<=MATCH(99^99,G:G)-5)),$G$1:$G$16)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  4. #4
    Registered User
    Join Date
    04-06-2012
    Location
    India
    MS-Off Ver
    Pro Plus 2019
    Posts
    70

    Re: Lookup from bottom of range, ignoring bottom n no. of rows

    Thanks @Bo_Ry & @AliGW for your Prompt responses.

    Both solutions work perfectly well.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Business (Win 10 - Work) & MS 365 Subscription Insider (Win 10 - Home)
    Posts
    42,092

    Re: Lookup from bottom of range, ignoring bottom n no. of rows

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  6. #6
    Registered User
    Join Date
    04-06-2012
    Location
    India
    MS-Off Ver
    Pro Plus 2019
    Posts
    70

    Re: Lookup from bottom of range, ignoring bottom n no. of rows

    Quote Originally Posted by Bo_Ry View Post
    Please try

    =LOOKUP(2,1/(F1:INDEX(F1:F16,COUNT(G1:G16)-5)=A3),G1:G16)
    Hi,

    While trying both the above formulas, I encounter an error if the range for lookup contains non-numeric values. Could you please take a look again?

    Sample file showing error attached.

    Thanks.
    Attached Files Attached Files

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    4,515

    Re: Lookup from bottom of range, ignoring bottom n no. of rows

    Please try

    =LOOKUP(2,1/(F1:INDEX(F1:F16,COUNT(F1:F16)-5)=A3),G1:G16)

    or

    =LOOKUP(2,1/(F1:INDEX(F1:F16,COUNTA(G1:G16)-5)=A3),G1:G16)

  8. #8
    Registered User
    Join Date
    04-06-2012
    Location
    India
    MS-Off Ver
    Pro Plus 2019
    Posts
    70

    Re: Lookup from bottom of range, ignoring bottom n no. of rows

    Solution resolves the error.
    Thanks once again Bo_Ry.
    Last edited by AliGW; 12-05-2018 at 04:26 AM.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    MS 365 Business (Win 10 - Work) & MS 365 Subscription Insider (Win 10 - Home)
    Posts
    42,092

    Re: Lookup from bottom of range, ignoring bottom n no. of rows

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

    Please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. OFFSETTING a reference range to exclude 3 bottom rows
    By drgkt in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-30-2017, 06:10 PM
  2. [SOLVED] Bottom Command Button does not take the user to the bottom of the ListBox
    By JJFletcher in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2017, 03:21 PM
  3. [SOLVED] Lookup the last 3 numbers in the bottom of range without empty cells
    By XLalbania in forum Excel General
    Replies: 8
    Last Post: 08-24-2016, 07:49 AM
  4. [SOLVED] Rows copying from bottom to top. need to copy top to bottom.
    By jafvortex93 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2015, 02:07 PM
  5. Need help deleting empty rows from a range from the bottom of the list up
    By pasqualebaldi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2014, 07:48 PM
  6. Draw bottom border on every rows from top to bottom
    By tantcu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-08-2013, 09:52 AM
  7. Replies: 1
    Last Post: 04-09-2006, 04:30 PM

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