Bonsoir,
Par macro, voici une proposition
Code à mettre dans un module
Option Explicit
Sub TriValMax()
Dim i As Long, j As Long
Dim Plage1 As Range, Plage2 As Range
Dim Cel11 As String, Cel12 As String
Dim Cel21 As String, Cel22 As String
Application.ScreenUpdating = False
With Sheets("Sheet1")
For i = 2 To Range("B" & Rows.Count).End(xlUp).Row + 1
j = i + 1
If .Cells(i, 1) = .Cells(i, 2) Then Cel11 = .Cells(i, 8).Address: Cel21 = .Cells(i, 8).Offset(, -5).Address
If .Cells(i, 2) <> .Cells(j, 2) Then
Cel12 = .Cells(i, 8).Address
Cel22 = .Cells(i, 8).Offset(, -5).Address
Set Plage1 = .Range(Cel11 & ":" & Cel12)
Set Plage2 = .Range(Cel21 & ":" & Cel22)
With .Range(Cel11).Offset(, 1)
.Formula = "=INDEX(" & Plage2.Address & ",MATCH(MAX(" & Plage1.Address & ")," & Plage1.Address & ",0))"
.Value = .Value
End With
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
Voir fichier joint pour test en cliquant sur le bouton GO