2 Replies Latest reply on Apr 29, 2014 3:45 AM by Annette

# Elapsed Time - Months

### 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))

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)))

• ###### 1. Re: Elapsed Time - Months

Let(
dateEnd = If ( IsEmpty ( Date2 ) ; Get ( CurrentDate ) ; Date2 ) ;

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

)

• ###### 2. Re: Elapsed Time - Months

THANK YOU!!!!!!