Function SommeNegative(r As Variant, P As Variant, ColTitre%, ColValeur%, ColCompte%)
Dim d As Object, i&, a
r = r
P = Intersect(P, P.Parent.UsedRange) 'matrice, plus rapide
Set d = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(P)
If P(i, ColCompte) = r Then d(P(i, ColTitre)) = d(P(i, ColTitre)) + P(i, ColValeur)
Next
a = d.items
For i = 0 To UBound(a)
If a(i) < 0 Then SommeNegative = SommeNegative + a(i)
Next
End Function