PDA

View Full Version : [SOLVED:] Array Average not working right..



black02ss
03-10-2005, 08:38 AM
I have this problem and I don't know why. I have enclosed a copy of my spreadsheet. When I run the MACRO "MAIN" from the Test Run 1 Sheet, it plots everything just fine, but the averages are wrong. It shows a average of 15.00 when it should be 14.63 for 99% of the cells... Any ideas on why this is happening??

Also, Is there a way that I can plot on the same table or another table that shows how many data points for the given field?? IE. 20 data points at map 50 rpm 800..

Thanks
Chad

Killian
03-10-2005, 09:12 AM
Hi Chad,
this is just me being stupid..!
I declared the arrays as arrays of integers :doh:
You need to change them to singles to accept floating point numbers
In Sub AnalyzeData, change:


Dim arrVals(1 To 19, 1 To 20) As Integer 'array to hold accumalated values
Dim arrCount(1 To 19, 1 To 20) As Integer 'array to hold count of values
to


Dim arrVals(1 To 19, 1 To 20) As Single 'array to hold accumalated values
Dim arrCount(1 To 19, 1 To 20) As Single 'array to hold count of values

black02ss
03-10-2005, 09:48 AM
You are the man K!! Now I just need to figure out how to get the data points for those values. :)