Const sCOST_CENTRE As String = "Cost Center"
lLastRow = wts.Cells(Rows.Count, 1).End(xlUp).Row
lLastDataRow = Sheet5.Cells(Rows.Count, 1).End(xlUp).Row
lBbgCol = wts.Cells(2, Columns.Count).End(xlToLeft).Column
For lTeamCount = 3 To lLastRow
sTeam = wts.Cells(lTeamCount, 2).Value
lDataCol = 16
For lBbgColCount = 3 To lBbgCol
lAvgCount = 0
dAvg = 0
dTotal = 0
dStd = 0
For lCount = 3 To lLastDataRow
If sTeam = Sheet5.Cells(lCount, 10).Value Then
If Sheet5.Cells(lCount, lDataCol).Value <> "#N/A" And Sheet5.Cells(lCount, lDataCol).Value > 0 Then
dTotal = dTotal + Sheet5.Cells(lCount, lDataCol).Value
lAvgCount = lAvgCount + 1
[color=#FFFF00] SumSq = (Sheet5.Cells(lCount, lDataCol).Value - dAvg) ^ 2
dStd = Round(Sqr(SumSq / (lAvgCount - 1)), 2)[/color]
End If
End If
Next
If lAvgCount > 0 Then
dAvg = Round(dTotal / lAvgCount, 2)
' SumSq = (Sheet5.Cells(lCount, lDataCol).Value - dAvg) ^ 2
'dStd = Round(Sqr(SumSq / (lAvgCount - 1)), 2)
End If
wts.Cells(lTeamCount, lBbgColCount).Value = dStd
lDataCol = lDataCol + 1
Next
Toujours pas le bon calcul
Mais je peux pas placer SumSq avec dAvg ...
Le calcul de l'ecart type est (X1 - Average)^2 + ... + (Xn - Average)^2 ( ce que je veux faire dans SumSq
Puis ensuite : Racine Carree de SumSq / nombre de valeurs dans la population - 1