MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Date calculation


Posted by Geraint Jones on May 25, 2000 2:14 PM

I need to calculate months between given dates, I have two qualifying periods.

A Date of Birth is quoted and when the animal reaches 6 Months old it gains 0.6 and then when it reaches 24 months it gains 1.0 .

I have the system looking at the date value in c1 if this is empty it looks at now(), this is to enable backdating.

I am managing to do the second part i.e. 24 months by using

=IF(YEARFRAC(A4,G4)>=2,1,0)

BUT my problem is this my first column 0.6 months has

=IF(YEARFRAC(A5,G5)<2,0.6,0).

This returns a value of 0.6 whether the animal has gained an age of 6 months or not. What I need to say is if date is > 6months but less than 24months then value is 0.6 but no matter what I do I can't seem to achieve this.

Please can you help

Geraint


Posted by Celia on May 25, 2000 4:37 PM

Geraint

=IF(YEARFRAC(A5,G5)<2, IF(YEARFRAC(A5,G5)<0.6,0,0.6),1).

Celia