View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default average of array element


Geoff,
I bet your array is declared as a numeric data type.
If so the default value of all elements is 0 (zero).
Declare the array as a Variant to have a truly empty array.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Geoff"
wrote in message
Hi All
I am trying to clean up a huge amount of data for further analysis.
One of the steps is to remove outliers. I have chosen to work with a
normal distribution and so want to delete all values that fall outside
of 3 deviations from the mean.
Application.Average(Application.Index(myArray, 0, c)) (c is the
column of the array)
Gives me the average but I have already deleted non numeric values and
also incorrect duplicate values. VBA for excel fills the empty pieces
in the array with zeros so my average is not correct. If I do this in
excel the average will exclude empty cells but in the array it does
not do this.
Is there a simple way to work around this.
Thank you in advance
Geoff