Option Explicit
Sub Ok_pas_Ok()
Dim i As Long
[A1].Sort Key1:=[A2], Header:=xlGuess
For i = 2 To Range("A65536").End(xlUp).Row
If Range("A" & i).Value = Range("A" & i).Offset(1, 0).Value Then
If Range("A" & i).Offset(, 1).Value = "ok" And Range("A" & i).Offset(1, 1).Value = "pas ok" Then Range("A" & i).Offset(, 3).Value = 1
End If
Next
[d1] = Application.WorksheetFunction.Sum(Range("d:d"))
End Sub