Thread: relative time
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
jsc3489 jsc3489 is offline
external usenet poster
 
Posts: 12
Default relative time

I have the following table to ease the computations:)

Date Days Sat,Sun Workable days Workable Hours
12/09/2005 30 5 21 168
4
01/09/2006 31 4 22 176
5
02/09/2006 31 4 23 184
4
03/09/2006 28 4 20 160
4
04/09/2006 31 5 21 168
5
05/09/2006 30 4 22 176
4
06/09/2006 31 4 23 184
4

--
I reject your reality and substitute my own.

Promote hydrogen - one of the best "clean" fuels there are!


"Ron Rosenfeld" wrote:

On Wed, 9 Nov 2005 07:12:08 -0800, "jsc3489"
wrote:

Ok, say I have a number representing time. For instance, 3.41 months. I would
like to calculate (with some accuracy) to how many days this is.

I have a reference date, and I use =DAY(DATE(YEAR(B4),MONTH(B4)+1,0))
to count the days in my reference date. I'm looking to "pick apart" the 3.41
to change my formula to the next month, count the days, etc.

I could then multiply .41 to the days in the 4th month and then add them all
together to get my end result.

Trick is, to do any of the above. Any Takers?


If you just have the number 3.41, with no starting date, there is no way to
determine accurately the amount of time. This is because "month" is not
precisely defined -- it could be 28-31 days long.

On the other hand, if what you want to do is add 3.41 months to some date, then
you would have to first define precisely how you are calculating that number.

One way to visualize the problem is to consider adding 1-2 months to 29-31
January.

You could define the increment as being calendar months, where the integer
represents the number of calendar months, and the fractional part represents
the sum of the fractional part of the first and last months.

With that concept, 29 Jan 2005 + 3.41 months --
3 calendar months takes us to 30 Apr 2005
The 2 days in January = 2/31 = .064516 leaving
0.41- 2/31 * 31(days in May) = 10.71 so, depending on your convention,
either 10 May or 11 May.

You could also define it in terms of fractions of a year, so 3.41 months =
365.25/12*3.41 days = 103.7919 days.

So then 29 Jan 2005 + 3.41 months -- =DATE(2005,1,29+103.7919) -- 12 May 2005
or 13 May 2005 again depending on how you want to round fractional days.


--ron