View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default convert # of years, months and days

On Fri, 1 Feb 2008 04:50:00 -0800, catrrmg
wrote:

Hi again! It just got slightly more complicated (or at least for me). Here is
an example to get the problem more clear: Mister X worked for a couple of
periods in our company:
start date end date years months days
19.12.2003 13.09.2005 1 8 25
09.10.2005 01.11.2006 1 0 23
09.11.2006 20.01.2008 1 2 11
total 3 10 59
As we see it the ex the # of days corresponds to more than a month. The
question is: how do I convert if it is necessary the # of days in months,
months years, taking into consideration that a month could be 28, 29, 30
and 31 days long.
Thanks very much in advance.


The short answer is that you can't, without adopting some kind of convention.
Don't forget that years can also be 365 or 366 days.

The simplest, in my opinion, would be to convert to days, or to weeks and days.

If start_date and end_date are named ranges, then

The days between any two dates is simply:

=end_date-start_date (and format as General or Number with 0 decimal places)

The total dates worked would be given by the **array** formula (enter with
<ctrl<shift<enter )

=SUM(end_date-start_date)

Other solutions could be to use the DAYS360 method, which assumes that all
months have 30 days. People will be upset because all of their "days" will not
count.

Or you could count calendar months + residual days, and ignore the fact that
the residual days are more than 30.
--ron