Anyone ever written a formula to calculate the number of months (including part months) between 2 dates? I have been struggling to come up with something that works for all cases.
Example 1:
Start Date = 01-Jan-04
End Date = 30-Jun-04
Months = 6
Example 2:
Start Date = 01-Jan-04
End Date = 15-Jun-04
Months = 5.5
Example 3:
Start Date = 20-Jan-04
End Date = 05-Jun-04
Months = 4.5333
The main problem I have is deciding whether to calculate the part months based on a standard 30 day month or to calculate them based on the month they fall in.
For example:
Start Date = 20-Jan-04
End Date = 31-Jan-04
Is this
a) 11 / 30 = 0.3666 months, or
b) 11 / 31 = 0.3548 months ??
If anybody has ever done anything like this before I would be interested in hearing about it.
Thanks
Example 1:
Start Date = 01-Jan-04
End Date = 30-Jun-04
Months = 6
Example 2:
Start Date = 01-Jan-04
End Date = 15-Jun-04
Months = 5.5
Example 3:
Start Date = 20-Jan-04
End Date = 05-Jun-04
Months = 4.5333
The main problem I have is deciding whether to calculate the part months based on a standard 30 day month or to calculate them based on the month they fall in.
For example:
Start Date = 20-Jan-04
End Date = 31-Jan-04
Is this
a) 11 / 30 = 0.3666 months, or
b) 11 / 31 = 0.3548 months ??
If anybody has ever done anything like this before I would be interested in hearing about it.
Thanks