Search code examples
google-sheetsdate-comparison

Obtain first date in column after reference date


In cell B1, I have =today() for today's date and then in the cells below (B2:B100), What I'm trying to do is to compare the date in cell B1 (today's date) and to find the next date that appear in cells B2:B100 AFTER this date and then copy this into A2.

So, in effect, in cell A2, I want a function to look up the next date in cells B2:B100 that is the nearest one AFTER B1 and then copy this into A2. I know this is a formula to add in A2 but just unsure what formula to use.

I've tried this in cell A2,

=MIN(IF(B2:B100>B1, B2:B100))

but it didn't work.


Solution

  • "Other things being equal", the formula is correct but should be entered in the array version (eg with Ctrl+Shift+Enter):

    =ArrayFormula(MIN(IF(B2:B100>today(),B2:B100)))
    

    Building the function from B1 into the formula is optional.