Function CR()
Application.Volatile
Dim Lig As Integer, Plage, i As Integer, Classement(), x As Integer, temp As Integer
Lig = Application.ThisCell.Row
If Lig > 2 Then
Plage = Range("A2:D" & Lig - 1)
For i = LBound(Plage, 1) To UBound(Plage, 1)
If Plage(i, 2) = Cells(Lig, 2) And Plage(i, 3) = Cells(Lig, 3) Then
x = x + 1
ReDim Preserve Classement(1 To 2, 1 To x)
Classement(1, x) = x
Classement(2, x) = Plage(i, 4)
End If
Next
If x > 0 Then
For i = LBound(Classement, 2) To UBound(Classement, 2)
temp = temp + (i * (11 - Classement(2, i)))
Next
CR = temp / UBound(Classement, 2)
Else
CR = "Inconnu"
End If
Else
CR = "Inconnu"
End If
End Function