Dim ecart, ecartmax, encour As Integer
Dim start As Boolean
For i = 1 To 4 'si tu n'as que 4 valeurs à tester
ecart = 0
ecartmax = 0
encour = 0
start = False
For J = 2 To 21 'nombre de lignes sur lesquelles se trouvent tes valeurs
ecart = ecart + 1
encour = encour + 1
If Cells(J, 1) = i Then
If start = False Then
start = True
ecart = 0
encour = 0
ElseIf start = True Then
If ecartmax < ecart Then
ecartmax = ecart
End If
ecart = 0
encour = 0
End If
End If
Next J
Cells(i + 1, 2).Value = ecartmax
Cells(i + 1, 3).Value = encour
Next i
End Sub