Thread: relative time
View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default relative time

My formula could take into account the varying number of days within a month
even without the table, but you still run into problems when the .41 months
is split between two months.

Example:
..41 months would be 11.5 days approx. if I am going by February of next year
(.41*28=11.48). That is fine if I apply it from today: 3 months brings me to
2/9, and then the .41 brings me 11.5 days after that so that is 2/20/06.

Now if it were 11/17 today: 3 months makes it 2/24. So now I add .41
months. If I use the .41*28 I get the 11.5 days and I am on 3/7/05. But
part of that .41 month was in March, which has 31 days. If I used .41*31 I
would have 12.7 days, which puts me on 3/8, not 3/7.

So do I use 28 days to calculate the .41, do I use 31, or some average, or
what? There is no predefined way to handle this. It depends on why you need
to find that particular date and how accurately you need to find it and where
the 3.41 comes from. And in the end, it may just be a judgment call.

So I just used 30 days, period, as my "month" for the fractional portion of
the calculation. If you need to do it differently you will need to figure
out the answer to the above issues.

--
- K Dales


"jsc3489" wrote:

I have the following table to ease the computations. It is dynamic. :)

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!


"K Dales" wrote:

".41 months" is a tricky concept. Is that .41 x 30 days? Or 31 days? Or
what if the month in which it applies is Feb - should I make it 28 days?
What if the period for which it applies begins in Feb but spans into March?
Do I use 28 days, 31 days, or prorate it based on the number of days that
fall in each month. So to avoid quibbling over these details I will use a
standard 30 day month in the formula. A1 would be the cell containing the
number of months:

=EOMONTH(TODAY(),INT(A1)-1)+DAY(TODAY())+(A1-INT(A1))*30
--
- K Dales


"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?
--
I reject your reality and substitute my own.

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