# a difficult date and month calculation problem

1. ## a difficult date and month calculation problem

I have five columns for one excel file using 2003 version
column A column B column C column D column E
27.8.2009 5 01.10.2011 X Y

column B means five years, X is derived by A+B-C in terms of years, column E is in terms of month. so for above example, X will be 2 (years) , Y will be 10 (months)

my major problem is how to design formula for column D and E? I have around 1000 such records

all columns are defined as general category, even if I try to format cells to "date" for column A
it can't be changed, so how to solve the issue? thanks  Register To Reply

2. ## Re: a difficult date and month calculation problem

Are the dates typed in as text or as proper dates? Try typing =YEAR(A1) and see if it produces a number.

It'll makes things easier if they are stored as proper dates.  Register To Reply

3. ## Re: a difficult date and month calculation problem

Try

=DATEDIF(DATE(RIGHT(C3,4),SUBSTITUTE(MID(C3,LEN(C3)-6,2),".",""),LEFT(3,FIND(".",C3)-1)),
DATE(RIGHT(A3,4)+B3,SUBSTITUTE(MID(A3,LEN(A3)-6,2),".",""),LEFT(A3,FIND(".",A3)-1)),"Y")

and

=DATEDIF(DATE(RIGHT(C3,4),SUBSTITUTE(MID(C3,LEN(C3)-6,2),".",""),LEFT(3,FIND(".",C3)-1)),
DATE(RIGHT(A3,4)+B3,SUBSTITUTE(MID(A3,LEN(A3)-6,2),".",""),LEFT(A3,FIND(".",A3)-1)),"YM")  Register To Reply

4. ## Re: a difficult date and month calculation problem

27.8.2009 isn't a valid date format, hence you have text in a cell that looks similar to a date.

You could try selecting all the cells with "dates" in them, formatting them as date and then doing a global replace of "." by "/".

Alternatively, you'll have to extract the month and year using MID.

Other than that, I'm not really sure I understand the calculations involved. Perhaps you could break it down? Column D (X) = ?+?+?

Regards

Regards  Register To Reply

5. ## Re: a difficult date and month calculation problem

The data that you have in the B column is posing a bit of a problem.

I have got the X using =YEAR(A2)+B2-YEAR(C2)

but the answer i get is 3.

Also, i used the Datedif function to get Y, but i am not sure how to i add 5 (col B data) in there.
The function i used is =DATEDIF(A2,C2,"m"). It returns 25 months which is correct if you count the months between 27th Aug 2009 and 1st October 2011. (Considering that you are in london and using the dd/mm/yy date format).  Register To Reply

6. ## Re: a difficult date and month calculation problem

Hi excel 2003 don't have datedif function, the logical is column A is item purchasing day, column B is useful lives , column C is now, column D is remaining useful live in terms of years, column E is remaing useful live in terms of month.

so pls help to design formula for column D and column E, help, please  Register To Reply

7. ## Re: a difficult date and month calculation problem Originally Posted by jolinchew Hi excel 2003 don't have datedif function,
Yes it does. Doesn't show in help, but it s there. Try it!  Register To Reply

8. ## Re: a difficult date and month calculation problem

Hi jolin,

The datedif function works in 2003. It's just not documented in Excel. Read...
http://www.cpearson.com/excel/datedif.aspx

also, when you say remaining life in years, do you mean 18 months of remaining life should tie in with a 1.5years remaining life? Or are expecting the answer as X = 1, Y = 6 months?  Register To Reply

9. ## Re: a difficult date and month calculation problem

giving my example, item is purchased in 2009.8, plus five years, so the last day is 2014.8, now is 2011.10
the item still has 2 years and 10 month, the problem is how to calculate 10 month in excel. guys pls help  Register To Reply

10. ## Re: a difficult date and month calculation problem

Hi jolin,

Please refer to the second formula in Bob's first post. It does the trick.  Register To Reply