Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Another play ..
With source numbers in A1 down. Put in say, B1: =IF(A1="","",TEXT(A1,"y")&" years, "&TEXT(A1,"m")&" months and "&TEXT(A1,"d")&" days") Copy B1 down -- Max Singapore http://savefile.com/projects/236895 xdemechanik --- "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. |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
True, except that that will give you 27 days, and not the 24 that the Op
wants ;-) -- Hth Kassie Kasselman "Max" wrote: Another play .. With source numbers in A1 down. Put in say, B1: =IF(A1="","",TEXT(A1,"y")&" years, "&TEXT(A1,"m")&" months and "&TEXT(A1,"d")&" days") Copy B1 down -- Max Singapore http://savefile.com/projects/236895 xdemechanik --- "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. |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Agreed <g.
8548 returns: 23 years, 5 months and 27 days It was just an "approx." thought thrown in here. I didn't want to get involved in the intricasies. -- Max Singapore http://savefile.com/projects/236895 xdemechanik --- "kassie" (Change all to lowercase) wrote in message ... True, except that that will give you 27 days, and not the 24 that the Op wants ;-) -- Hth Kassie Kasselman |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
On Sun, 24 Dec 2006 00:13:00 -0800, K. Krishna Murthi <K. Krishna
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. Because both years and months have varying numbers of days, the "best" answer to your question is not defined. You would have to first define exactly what you mean by a year, and a month, in terms of days. You could use the DATEDIF function. See http://www.cpearson.com/excel/datedif.htm Years: =DATEDIF(,A1,"y") Months: =DATEDIF(,A1,"ym") Days: =DATEDIF(,A1,"md") So: =DATEDIF(,A1,"y") & " Years, "& DATEDIF(,A1,"ym")&" months and "& DATEDIF(,A1,"md")&" days." --ron |
#7
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
It looks like the only months when 8548 days added to a date will give a
difference of 23 years, 4 months and 24 daya are May, July and October. Try using: =DATEDIF(A1,A1+$E$1,"y")&" Years "&DATEDIF(A1,A1+$E$1,"ym")&" Months "&DATEDIF(A1,A1+$E$1,"md")&" Days" with the start date in A1 and 8548 in E1 ( the $'s were because I dragged the formula down to a start date of 2015 to check when you would get 24 days) -- HTH Sandy In Perth, the ancient capital of Scotland and the crowning place of kings with @tiscali.co.uk "K. Krishna Murthi" <K. Krishna wrote in message ... 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Convert numbers from text format to number format | Excel Discussion (Misc queries) | |||
Calculate Number of Months Weeks and Days Between Two Dates | Excel Worksheet Functions | |||
convert number to date format | Excel Discussion (Misc queries) | |||
HOW DO I CALCULATE THE YEARS MONTHS AND DAYS BETWEEN SEVERAL DATE | Excel Discussion (Misc queries) | |||
holiday dates | Excel Worksheet Functions |