VBA
1Sub sample()
2
3 Dim score(1 To 5, 1 To 3)
4 Dim avgAry(1 To 5)
5 Dim sdAry(1 To 5)
6 Dim minAry(1 To 5)
7 Dim maxAry(1 To 5)
8
9 Dim i, j
10 For i = 1 To 5
11 For j = 1 To 3
12 score(i, j) = Cells(i + 1, j + 1).Value
13 Next j, i
14
15 For i = 1 To 5
16 Dim sm, mn, mx, sd
17 sm = 0
18 mn = 100
19 mx = 0
20 sd = 0
21
22 For j = 1 To 3
23 sm = sm + score(i, j)
24 If score(i, j) < mn Then mn = score(i, j)
25 If score(i, j) > mx Then mx = score(i, j)
26 Next
27
28 avgAry(i) = sm / 3
29 minAry(i) = mn
30 maxAry(i) = mx
31
32 For j = 1 To 3
33 sd = sd + (score(i, j) - avgAry(i)) ^ 2
34 Next
35 sdAry(i) = Sqr(sd / 3)
36 Next
37End Sub
38
VBA
1Sub sample2()
2 Dim arr As Variant
3 arr = Range("B2:D6").Value
4
5 Dim avgAry(1 To 5)
6 Dim sdAry(1 To 5)
7 Dim minAry(1 To 5)
8 Dim maxAry(1 To 5)
9
10 With WorksheetFunction
11 Dim i
12 For i = 1 To 5
13 avgAry(i) = .Average(.Index(arr, i, 0))
14 sdAry(i) = .StDev_P(.Index(arr, i, 0))
15 minAry(i) = .Min(.Index(arr, i, 0))
16 maxAry(i) = .Max(.Index(arr, i, 0))
17 Next
18 End With
19End Sub