Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub CalcWeightedEst()
- Dim i As Integer
- For i = 5 To 50
- Dim sum As Integer
- Dim avg As Double
- Dim distMeanOne As Double
- Dim distMeanTwo As Double
- Dim distMeanThree As Double
- Dim deviation As Double
- sum = Cells(i, 2).Value + Cells(i, 3).Value + Cells(i, 4).Value
- avg = sum / 3
- If sum > 0 Then
- distMeanOne = Abs(Cells(i, 2).Value - avg) ^ 2
- distMeanTwo = Abs(Cells(i, 3).Value - avg) ^ 2
- distMeanThree = Abs(Cells(i, 4).Value - avg) ^ 2
- deviation = (distMeanOne + distMeanTwo + distMeanThree) / 3
- deviation = Sqr(deviation)
- If Cells(i, 5).Value = "Low" Then
- Cells(i, 6).Value = avg
- End If
- If Cells(i, 5).Value = "Medium" Then
- Cells(i, 6).Value = avg + (deviation * 1)
- End If
- If Cells(i, 5).Value = "High" Then
- Cells(i, 6).Value = avg + (deviation * 2)
- End If
- End If
- Next i
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement