jrhess003
04-27-2016, 01:53 PM
I am missing something from my code for my homework.
Mycovar
Y
X
17
20
2
24
36
29
48
35
12
43
22
52
88
63
55
76
33
91
45
10
11
33
12
16
13
92
14
23
15
78
16
34
17
40
18
48
19
57
20
69
#VALUE!
The function is a summation with the formula listed below (x(i)-xbar)*(y(i)-ybar).
Here is what I have so far:
Function MyCovar(x, y)
xbar = Application.WorksheetFunction.Average(x)
ybar = Application.WorksheetFunction.Average(y)
Nper = x.Rows.Count
Sum = 0
For i = 1 To Nper
Sum = (x(i) - xbar) * (y(i) - ybar)
Next i
MyCovar = Sum
End Function
Thanks to any answers.
Mycovar
Y
X
17
20
2
24
36
29
48
35
12
43
22
52
88
63
55
76
33
91
45
10
11
33
12
16
13
92
14
23
15
78
16
34
17
40
18
48
19
57
20
69
#VALUE!
The function is a summation with the formula listed below (x(i)-xbar)*(y(i)-ybar).
Here is what I have so far:
Function MyCovar(x, y)
xbar = Application.WorksheetFunction.Average(x)
ybar = Application.WorksheetFunction.Average(y)
Nper = x.Rows.Count
Sum = 0
For i = 1 To Nper
Sum = (x(i) - xbar) * (y(i) - ybar)
Next i
MyCovar = Sum
End Function
Thanks to any answers.