Please create the VB code to calculate Standard Deviation ie
Please create the VB code to calculate Standard Deviation
i.e Sub STD DEV().......End Sub
| 21 |
| 12 |
| 343 |
| 546 |
| 67 |
| 879 |
| 90 |
| 23 |
| 231 |
| 53 |
| 67 |
| 89 |
Solution
Sub STD DEV()
Dim result As Double = 0.0
Dim result2 As Double = 0.0
Dim sum As Double =0.0
Dim i As Integer = 0
Dim count As Integer =0
For i =0 to data.Count -1
If data(i) Is DBNull.Value Then
sum+=0
Else
sum+=data(i)
End If
count+=1
Next i
result2=sum/data.Count
For i=0 to data.Count -1
If data(i) Is DBNull.Value Then
result+=0
Else
result+=Sqrt((data(i) - result2)^2) / (data.Count -1)
End If
Next i
End Sub

