Salut Akacio,
Salut H2so4,
Un double-clic sur une valeur en [A:B] déclare cette valeur en [B1] comme valeur-référence pour la fonction.
Public Function fctConcat(rCel As Range) As String
'
Dim iRow%, sFlag$
'
Application.Volatile
'
With Worksheets("MAIN")
iRow = .Range("A" & Rows.Count).End(xlUp).Row
.Range("A2:B" & iRow).Font.Color = RGB(195, 195, 195)
For x = 2 To iRow
If .Cells(x, 1) = rCel Or .Cells(x, 2) = rCel Then _
.Cells(x, IIf(.Cells(x, 1) = rCel, 1, 2)).Font.Color = RGB(255, 0, 0): _
If .Cells(x, 3) <> "" And .Cells(x, 4) <> "" And IsNumeric(.Cells(x, 3)) And IsNumeric(.Cells(x, 4)) Then _
sFlag = sFlag & IIf(.Cells(x, 1) = rCel And .Cells(x, 3) > .Cells(x, 4), "H", ""): _
sFlag = sFlag & IIf(.Cells(x, 1) = rCel And .Cells(x, 3) < .Cells(x, 4), "B", ""): _
sFlag = sFlag & IIf(.Cells(x, 2) = rCel And .Cells(x, 4) > .Cells(x, 3), "H", ""): _
sFlag = sFlag & IIf(.Cells(x, 2) = rCel And .Cells(x, 4) < .Cells(x, 3), "B", ""): _
sFlag = sFlag & IIf(.Cells(x, 3) = .Cells(x, 4), "P", "")
Next
End With
fctConcat = sFlag
'
End Function
A+