How do I convert a number into Years, Months, Days format?
What about leap years? Do you take Y1, Y2, Y3 or Y4 as one?
With your number in A1, =ROUNDDOWN(A1/365.25,0) in B1;
=ROUNDDOWN((A1-(B1*365.25))/31,0) in C1 and
=ROUNDUP(A1-(B1*365.25)-(C1*31),0) in D1 will give your calculated answer of
23y, 4m and 24d.
However, while the 365.25 caters for leap years, 31 days in C1 and D1 are
incorrect, since months have varying numbers of days. If you replace the 31
with 30,4375, (in C1), and replace the formula in D1 with
=ROUNDDOWN(A1-(B1*365.25)-(C1*30.4375),0) you will get 23y, 4m and 25, iso 24
days.
--
Hth
Kassie Kasselman
"K. Krishna Murthi" wrote:
I want to convert a number and display it as Number of Years, Months and
Days. eg
8548 converts into 23 Years, 4months and 24 days.
|