Sub test()
Set dico = CreateObject("Scripting.dictionary")
For n = 3 To Range("D" & Rows.Count).End(xlUp).Row
If Range("Q" & n) < 500 Then
x = Range("D" & n) & Range("F" & n)
dico(x) = dico(x) & n & ";"
End If
Next
b = dico.items
For n = LBound(b) To UBound(b)
x = Split(b(n), ";")
If UBound(x) = 2 Then
Cells(x(0), "D").Interior.ColorIndex = 40
Cells(x(1), "D").Interior.ColorIndex = 40
Cells(x(0), "F").Interior.ColorIndex = 40
Cells(x(1), "F").Interior.ColorIndex = 40
End If
If UBound(x) = 3 Then
Cells(x(0), "D").Interior.ColorIndex = 3
Cells(x(1), "D").Interior.ColorIndex = 3
Cells(x(2), "D").Interior.ColorIndex = 3
Cells(x(0), "F").Interior.ColorIndex = 3
Cells(x(1), "F").Interior.ColorIndex = 3
Cells(x(2), "F").Interior.ColorIndex = 3
End If
Next
End Sub