Function MoyennePondere(Notes, Sur, Coef)
Dim Tn, Ts, Tc, Somme, Diviseur, i
Tn = Notes: Ts = Sur: Tc = Coef: Somme = 0: Diviseur = 0
For i = 1 To UBound(Tn, 2)
If Tn(1, i) <> "" Then
Diviseur = Diviseur + Tc(1, i)
Somme = Somme + 20 * Tc(1, i) * Tn(1, i) / Ts(1, i)
End If
Next i
If Diviseur = 0 Then MoyennePondere = "" Else MoyennePondere = Round(Somme / Diviseur, 2)
End Function