Datediff & bissextile year
Rick,
Thanks, this code works. Thing is, i built it in the rest of the code now
and when I run the code I get a type mismatch.
Gr.
Basta
"Rick Rothstein" wrote:
I think this code will do what you want...
ActiveCell.Offset(0, 1).Value = Year(Range("c2").Value) - _
Year(ActiveCell.Value) + _
(Format(Range("c2").Value, "mmdd") < _
Format(ActiveCell.Value, "mmdd"))
--
Rick (MVP - Excel)
"Basta1980" wrote in message
...
Hi,
I have a list of employees in column A2 through to column A*. In Column B2
through to Column B is their corresponding d.o.b. I have a code (used from
other thread in this community) to retrieve age in years. This works fine,
except for years leading upto a bissextile year. What happens is when I
have
d.o.b. 15-2-1988 and age per is 15-2-2000 the result is 12 (which is
correct). But when d.o.b. is 15-2-1987 and age per is 15-2-2000 the result
is
also 12 (which should be 13). How can I solve this problem?!
The code is
ActiveCell.Offset(0, 1) = Int(DateDiff("d", ActiveCell.Offset(0, 0).Value,
Range("c2").Value) / 365.25)
Regards
Basta1980
|