Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Marlene Mayer
 
Posts: n/a
Default Convert # of days to years/days

I'm having a bit of a problem with a format that I think should work,
but isn't. I'm trying to convert the total # of days to years/days.
For example, in Column A1, I have 425 as the # of days. I've formatted
Column B with a custom format of yy "Years" dd "Days". For 425 days,
it should end up giving me a result of approximately 1 Year 60 Days,
however it is returning a result of 1 year 28 days. Any assistance that
can be offered with this would be greatly appreciated, thanks!!
  #2   Report Post  
Biff
 
Posts: n/a
Default

Hi!

The reason you're getting 1 year 28 days is because 425 is the date serial
number for Feb 28 1901.

This may be a little overkill but it does what you want and assumes that ALL
years are 365 days:

=INT(A1/365)&IF(INT(A1/365)=1,"Year ","Years
")&IF(MOD(A1,365)=1,MOD(A1,365)&" Day",MOD(A1,365)&" Days")

Biff

"Marlene Mayer" wrote in message
...
I'm having a bit of a problem with a format that I think should work, but
isn't. I'm trying to convert the total # of days to years/days. For
example, in Column A1, I have 425 as the # of days. I've formatted Column
B with a custom format of yy "Years" dd "Days". For 425 days, it should
end up giving me a result of approximately 1 Year 60 Days, however it is
returning a result of 1 year 28 days. Any assistance that can be offered
with this would be greatly appreciated, thanks!!



  #3   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default

On Mon, 25 Apr 2005 21:13:33 -0600, Marlene Mayer
wrote:

I'm having a bit of a problem with a format that I think should work,
but isn't. I'm trying to convert the total # of days to years/days.
For example, in Column A1, I have 425 as the # of days. I've formatted
Column B with a custom format of yy "Years" dd "Days". For 425 days,
it should end up giving me a result of approximately 1 Year 60 Days,
however it is returning a result of 1 year 28 days. Any assistance that
can be offered with this would be greatly appreciated, thanks!!


You cannot do that by formatting. When you format a cell as a date, Excel
interprets the result as a date with day 1 = 1/1/1900 (or 1/1/1904 depending on
the date setting). So your format is giving the year and day of whatever date
is 425 days from the start of the date system. In your case it is giving the
year and day of the date 28 Feb 1901.

To convert your 425 into years & days, you first have to adopt a convention for
how many days in a year, since it can differ.

One simple way would be to assume 365.25 days in a year, and that you want to
round the fractional days:

=INT(A1/365.25) & " Years " &
ROUND(MOD(A1/365.25,1)*365.25,0) & " Days"


--ron
  #4   Report Post  
Marlene Mayer
 
Posts: n/a
Default

Thanks to both Biff & Ron, that's exactly what I was looking for!!

Ron Rosenfeld wrote:

On Mon, 25 Apr 2005 21:13:33 -0600, Marlene Mayer
wrote:



I'm having a bit of a problem with a format that I think should work,
but isn't. I'm trying to convert the total # of days to years/days.
For example, in Column A1, I have 425 as the # of days. I've formatted
Column B with a custom format of yy "Years" dd "Days". For 425 days,
it should end up giving me a result of approximately 1 Year 60 Days,
however it is returning a result of 1 year 28 days. Any assistance that
can be offered with this would be greatly appreciated, thanks!!



You cannot do that by formatting. When you format a cell as a date, Excel
interprets the result as a date with day 1 = 1/1/1900 (or 1/1/1904 depending on
the date setting). So your format is giving the year and day of whatever date
is 425 days from the start of the date system. In your case it is giving the
year and day of the date 28 Feb 1901.

To convert your 425 into years & days, you first have to adopt a convention for
how many days in a year, since it can differ.

One simple way would be to assume 365.25 days in a year, and that you want to
round the fractional days:

=INT(A1/365.25) & " Years " &
ROUND(MOD(A1/365.25,1)*365.25,0) & " Days"


--ron



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 Function Disappered in Excel Gord Dibben Excel Discussion (Misc queries) 3 April 13th 05 07:59 PM
How to convert hours in days? Tony Excel Worksheet Functions 3 March 9th 05 04:09 PM
Subracting Dates to come up with the # of days between them KimberlyC Excel Worksheet Functions 8 December 20th 04 09:46 PM
Convert Numeric into Text Monty Excel Worksheet Functions 0 December 18th 04 09:25 PM
Help! I am stuck calculating Days, Hours, Mins please help OB1 Excel Worksheet Functions 3 November 15th 04 05:17 PM


All times are GMT +1. The time now is 11:52 PM.

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

About Us

"It's about Microsoft Excel"