+ Reply to Thread
Results 1 to 4 of 4

Last entry in a range before date defined by a cell

  1. #1
    Registered User
    Join Date
    11-25-2020
    Location
    Brasil - São Paulo
    MS-Off Ver
    360
    Posts
    2

    Last entry in a range before date defined by a cell

    so, i have two sheets.
    one of them with a bunch of entries by date.
    on the second one i want a formula to pick the last entry before date on another cell.

    what i've got so far is: =index(sheet1!A:A;if(and(sheet1A:A<=G2;sheet1!A:A<>"");max(sheet1!A:A<>"")*(LIN(sheet1!A:A))))

    the problem with this formula is that its showing all entries not empty in a list (instead only the last result) and also showing results above the date set on G2

    i think there might be a even better formula for what I want... although this method should work...

    cells in sheet1!A:A are dates, as well as data in G2.

    Thanks in advance!

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,409

    Re: Last entry in a range before date defined by a cell

    I have no idea what LIN function is, but below helps to get last date occurance in A:A that earlier date in G2

    =lookup(2;1/(sheet1A:A<=G2)/(sheet1!A:A<>"");sheet1!A:A)
    Quang PT

  3. #3
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,803

    Re: Last entry in a range before date defined by a cell

    It's always best to attach a sample file (see the yellow banner at the top). That way we don't have to guess as much and we don't have to re-type any data. Anyway, because you're on MS365, you might be able to use the Xlookup formula, although I'm not entirely sure I understand what you mean when you say, " pick the last entry BEFORE date on another cell". (This is why a sample sheet with MOCKED UP answers is helpful).

    =XLOOKUP(G2,sheet1!A:A,return array,,-1,-1)

  4. #4
    Registered User
    Join Date
    11-25-2020
    Location
    Brasil - São Paulo
    MS-Off Ver
    360
    Posts
    2

    Re: Last entry in a range before date defined by a cell

    Thanks for the tips both of you!
    i got what i need.
    im actually using google spreadsheet on this workbook.
    but lookup function worked there much better after a few adjustments for spreadsheet.
    Next time i will try to be more clear and upload something to help you help me

    rly appreciate the help

+ 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. [SOLVED] Split Value across date range as per defined date ?
    By VICTOR5 in forum Excel General
    Replies: 4
    Last Post: 12-23-2019, 04:07 AM
  2. Copy cells in a defined range > 0, paste in a defined cell on other worksheet
    By Jackson2806 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-04-2019, 08:52 PM
  3. [SOLVED] subset of range defined by start date and date date in dedicated cells
    By Pragmaticite in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-23-2015, 05:30 PM
  4. Validate that entry in one cell matches an entry in another range of cells
    By Grilleman in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-01-2014, 03:57 PM
  5. Replies: 10
    Last Post: 07-24-2013, 11:48 AM
  6. Set Date Range within a defined range, not to start before first date defined
    By Chicago_girl1 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-06-2012, 01:31 PM
  7. Application-defined or Object-defined error on Formula entry
    By Kaigi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-12-2009, 01:33 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