Sub Compter()
Dim n1&, n2&
Application.ScreenUpdating = False
With Worksheets("Feuil1")
If .FilterMode Then .ShowAllData
n1 = .Cells(.Rows.count, "a").End(xlUp).Row
.Columns("a:a").Resize(n1).Copy .Cells(1, "c"): .Columns("d:d").Clear
.Columns("c:c").Resize(n1).RemoveDuplicates Array(1)
n2 = .Cells(.Rows.count, "c").End(xlUp).Row
.Cells(1, "d").FormulaLocal = "=NB.SI(a$1:a$" & n1 & ";c1)"
.Cells(1, "d").AutoFill Destination:=.Cells(1, "d").Resize(n2)
.Cells(1, "d").Resize(n2) = .Cells(1, "d").Resize(n2).Value
End With
End Sub