Reputation: 1
On Sheet 1 I have a range of dates in columns A & C. On Sheet 2 I have a list of items that include a date of occurrence in column M. I need a formula on Sheet 2 column A that will evaluate that date of occurrence, determine which date range from Sheet 1 this date falls into, and return the value of the starting date range. So, for the images attached, the formula would return the 5/18/24 date in cell A2 on Sheet 2 because the date of occurrence (6/3/24) falls in between 5/18/24 thru 6/14/24. Date Ranges Formula cell
I am struggling to determine the correct formula.
Upvotes: 0
Views: 393
Reputation: 1752
If you don't have any overlapping date ranges, and every occurrence date is guaranteed to be in one of the provided ranges, then the xlookup
function will do this easily. The goal is to find the closest value in column A (on Sheet 1) that is equal to or less than the occurrence date in column M (on Sheet 2).
If you haven't used xlookup
before, its arguments are:
So, a formula like:
=xlookup(M2, Sheet1!A:A, Sheet1!A:A, "no match found", -1)
in cell A2 on Sheet2 should be a good place to start.
Upvotes: 1