AnsweredAssumed Answered

Elapsed Time - Months

Question asked by Annette on Apr 29, 2014
Latest reply on Apr 29, 2014 by Annette

Title

Elapsed Time - Months

Post

     Hi,

     I was looking to find the elapsed time between two dates in months.  I searched the forum and found the following:

     The following calculation will calculate the number of elapsedmonths between two dates. This formula assumes that Date2 is later than Date1.  

     (Year(Date2 + 1) - Year(Date1 + 1)) * 12 + (Month(Date2 + 1) - Month(Date1 + 1)) - If (Day (Date2 + 1) = Day (Date1), 0, If (Day (Date2 + 1) < Day (Date1+1), 1, 0))

     Found here:  http://help.filemaker.com/app/answers/detail/a_id/5139/kw/months%20elapsed

     Works just as I need.  The only thing is, I wanted to say if Date 2 was blank get the current date.  I wrote it as follows but it does not work.  What have I dont wrong? 

     If(IsEmpty(Date2) ; Get (CurrentDate); (Year(Date2 + 1) - Year(Date1 + 1)) * 12 + (Month(Date2 + 1) - Month(Date1 + 1)) - If (Day (Date2 + 1) = Day (Date1), 0, If (Day (Date2 + 1) < Day (Date1+1), 1, 0)))

Outcomes