View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Sam Wilson Sam Wilson is offline
external usenet poster
 
Posts: 523
Default Writing a VBA program

Me again,

Yor original formula was "=Average(A-B,B-C,C-D,D-E)" (can't be bothered
writing the cell addresses so I've used A,B,C,D,E)

My point was that that average would be worked out as follows:
[(A-B) + (B-C) + (C-D) +...]/4 which is the same as:

[A + (B-B) + (C-C) + ... - E]/4 which is the same as

(A-E)/4

so it works out identical, never mind similar!

Sam


"subvanpatent" wrote:

Sam,

This is the average of the difference between two close dates. I felt it
might be more accurate then the average you suggested. They are fairly
close. I like to see how close.

Thanks,
--
Jim


"Sam Wilson" wrote:

Isn't that the average of the dates, rather than the average time between
dates?

"Joel" wrote:


Function MyAverage(ParamArray Target() As Variant)

MyAverage = 0
For Each num In Target
MyAverage = MyAverage + num
Next num
MyAverage = MyAverage / (UBound(Target) + 1)
End Function


"subvanpatent" wrote:

I am trying to write a script to help me determine the Mean Time Between
Repair for equipment. I played with it all day yesterday but was not able to
figure it out. Right now I have to enter the string manually. The formula I
am using is "=AVERAGE(C7-C6,C6-C5,C5-C4,C4-C3,C3-C2)" where C7 would be the
latest date to C2 the earliest date. As you can see this would become
cumbersome with numerous dates.

Thanks,
--
Jim