PDA

View Full Version : Total Months in Between Two Dates



krishhi
03-09-2010, 09:18 PM
Hi,
I have some issue. I want to find out the difference between two dates(Here i need Months).
1. The first date is vary from cell to cell.
2. The Second date is Constant.
I need to find out the difference between these two. and i have some condition if the date below the 1 - 15days, it should concern the whole month. or else it should concern the count the next month.

If i have two dates, let say : 03/09/2008 (mm/dd/yyyy) and constant date is : 12/12/2009
Here the difference of the months is: 10 (because the date is below 15)
and check another example :
05/16/2008 (mm/dd/yyyy) and constant date is : 12/12/2009
here the difference of the months is :19 (because the date is above 15)
Thanks
Krish

GTO
03-09-2010, 09:48 PM
Probably just me, but presming you meant 12/12/2008, I am not seeing: Why are we counting the last month (December) when it is below the 15th day?

Aussiebear
03-09-2010, 11:31 PM
Are you sure that your maths in the example are correct?

krishhi
03-10-2010, 12:10 AM
@GTO AND @AUSSIEBEAR

I want to figureout the total number of months of the employee from the date of joining.

If he joined before the 15 th of the Month, we need to consider the Month into the count. Else we will leave the month and count from the next month.

@aussiebear
Ya i am poor in maths. :P

Bob Phillips
03-10-2010, 01:48 AM
Try

=DATEDIF(join.date,DATE(YEAR(fixed.date),MONTH(fixed.date)+1,0),"M")+(DAY(join.date)<=15)