Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How do I convert a number into Years, Months, Days format?

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 80
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default How do I convert a number into Years, Months, Days format?

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 80
Default How do I convert a number into Years, Months, Days format?

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default How do I convert a number into Years, Months, Days format?

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default How do I convert a number into Years, Months, Days format?

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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,345
Default How do I convert a number into Years, Months, Days format?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert numbers from text format to number format merlin68 Excel Discussion (Misc queries) 7 June 20th 07 07:03 PM
Calculate Number of Months Weeks and Days Between Two Dates [email protected] Excel Worksheet Functions 4 September 22nd 06 01:47 AM
convert number to date format Lesley Excel Discussion (Misc queries) 4 July 12th 06 09:17 PM
HOW DO I CALCULATE THE YEARS MONTHS AND DAYS BETWEEN SEVERAL DATE Susan Excel Discussion (Misc queries) 1 June 29th 06 02:27 PM
holiday dates bucci Excel Worksheet Functions 4 June 15th 06 09:35 AM


All times are GMT +1. The time now is 02:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"