ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   calculting stats of column array in 3D array (https://www.excelbanter.com/excel-programming/290303-calculting-stats-column-array-3d-array.html)

[email protected]

calculting stats of column array in 3D array
 
I am storing school marks by student by class over a 4 semester
period. each student takes 5 classes each semester and continues on
to the next level each semester. Thus student 1 takes Math1,
English1, Physics1, Chem 1, PhysEd 1 in the first Semester. In
Semester 2 all the same kids take Math2, English 2 etc. I will assume
no failure for the purpose of this. Data collected with look like
table below. But this will be 3D by semester

Semester 1
Course---Cr1Cr2Cr3Cr4
Student1-20%20%20%20%
Student2-60%60%60%60%
Student3-80%80%80%80%

I eventually want to calculte the min/max/avg marks for each subject
in each semester. Once all the data is calculated I want to pass the
min/max/avg to a summary array. I would like to end up with the
following table:

Semester 1
Course Cr1Cr2Cr3Cr4
Min----20%20%20%20%
Max----80%80%80%80%
Avg----60%60%60%60%

And since I have this over 4 semester, I want to be able to create all
four verions of this table. I cant seem to figure out how to calc the
min/max/avg of the column arrays.

Can anyone help me with this.

Option Base = 1
Dim A As Single
Dim B As Single
Dim C As Single
Dim Data() As Variant
Dim Max As Single
Dim Min As Single
Dim Avg As Single
Dim StatsArray As Variant

For A = 1 to 4
For B = 1 to 5
For C = 1 to 20
Data(C,B,A) = rnd()
Next C
Min = ?????
MAx = ?????
Avg = ?????
StatsArray(1,B,C) =Min
StatsArray(1,B,C) =Max
StatsArray(1,B,C) =Avg
Next B
Nect A

Thanks in advance

TS


All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com