I am trying to write a function that will search a column for a particular date and return the row number. The dates are in order although there may be duplicates. If it can't find that date, then it must keep searching for a day earlier each time until it finds any date after January 1st or an error code if the column is empty. If it finds duplicate dates, the function must return the row of the last/latest one.
Example, suppose the column has ten dates, 2 at January 1st, 2 at February 1st and 6 at March 1st. I ask the function to return the row number of February 28th. It should return the number 4 because there are only 4 rows up to that date.
I'm afraid I can't get my head around this at all. I think it will need VLOOKUP in a backwards searching loop, but I'm not sure how to code it. Any suggestions? Thanks!
I may not be around to answer questions about this immediately, but I will respond as soon as I can.
Bookmarks