help with date formula

Occasional Visitor

I need the datedif of a cell from today to equal the number of months left on a project. The formula I have works except when it should say zero, it says #NUM!. 

1 Reply


DATEDIF will return #NUM! if the end date of the project is earlier than today. You can get around this by wrapping DATEDIF in IFERROR:


=IFERROR(DATEDIF(TODAY(), end_date, "m"), 0)


Alternatively, use something like


=DATEDIF(TODAY(), MAX(end_date, TODAY()), "m")