Forum Discussion

gracecart's avatar
gracecart
Copper Contributor
Sep 30, 2021

"IF" function for date

hi - trying to understand how to write an IF statement that will check a cell in a column to see if the date in that cell is prior to a specific date, return the word "on time", but if later than that specific date, return the word "late"....i can't figure out how to write the date so it brings the data back correctly

 

1 Reply

  • gracecart 

    Let's say the cell is D2, and you want to compare it to October 15, 2021.

     

    =IF(D2<=DATE(2021,10,15),"On Time","Late")

     

    If the date you want to compare to is in a fixed cell, say in M1, use

     

    =IF(D2<=$M$1,"On Time","Late")

     

    If the date you want to compare to should always be in the same row as the cell with the formula, say in column M, use

     

    =IF(D2<=M2,"On Time","Late")

     

    Each of these can be filled down if required.

Resources