Quote:

> Hey this might be a dumb question but i really need help

> on this, can someone help me write a little program that

> takes any amount of numbers and averages them? thanks ALOT

I'll have to assume the usual methods aren't working out. This solves

a slightly different problem, but you shouldn't have too much trouble

adapting it...

Public Function Deviants(ByRef Array1() As Double, _

Optional ByVal Tolerance As Double = 0.05) As Long

Dim LB As Long: LB = LBound(Array1)

Dim UB As Long: UB = UBound(Array1)

Dim C As Double: C = UB - LB + 1

Dim M1 As Long: M1 = CLng(Rnd * (UB - LB)) + LB

Dim M2 As Long: M2 = CLng(Rnd * (UB - LB)) + LB

Debug.Assert LB <= M1 And M1 <= UB

Debug.Assert LB <= M2 And M2 <= UB

Dim M As Double, T As Double, i As Long

M = Array1(LB) / 4 + Array1(M1) / 4 + Array1(M2) / 4 + Array1(UB) / 4

For i = LB To UB

T = T + (Array1(i) - M) / C

Next

M = M + T

For i = LB To UB

If Abs((Array1(i) - M) / M) > Tolerance Then Deviants = Deviants + 1

Next

End Function

Interestingly, if you may clobber the array, it might be faster to find

the median.

--

Joe Foster <mailto:jlfoster%40znet.com> Got Thetans? <http://www.xenu.net/>

WARNING: I cannot be held responsible for the above They're coming to

because my cats have apparently learned to type. take me away, ha ha!