Function Compte()
Dim Plage, i As Long, Ligne As Long
Dim MonDico
Set MonDico = CreateObject("Scripting.Dictionary")
Ligne = Application.ThisCell.Row
Plage = Range("A2:B" & Range("A" & Rows.Count).End(xlUp).Row)
For i = LBound(Plage) To UBound(Plage)
If Plage(i, 1) = Range("A" & Ligne) Then
MonDico(Plage(i, 2)) = ""
End If
Next
Compte = MonDico.Count
Set MonDico = Nothing
End Function
Sub CompteOccurences()
Set mondico = CreateObject("Scripting.Dictionary")
For Each c In Range("A1", [A65000].End(xlUp))
temp = c & "-" & c.Offset(, 1)
mondico(temp) = IIf(mondico.exists(temp), mondico(temp) + 1, 1)
Next c
a = mondico.keys
For i = 0 To UBound(a)
s = Split(a(i), "-")
Cells(i + 1, "I") = s(0)
Cells(i + 1, "J") = s(1) ' enlever si pas nécessaire
Next
[K1].Resize(mondico.Count, 1) = Application.Transpose(mondico.items)
End Sub
Rachid ta formule me donne le bon resultat mais avec toutes mes lignes me semble vraiment trop longue,mon seul moyen de gagner vraiment du temps serais un code VBA Grosselien et Paf merci pour votre reponse j'ai essayé vos codes VBA mais celle-ci ne m'affiche rien (j'ai commencé il y 4 mois dans le VBA je suis debutant)
ci-joint le fichier avec le bouton que j'ai generé pour lancer la macro il doit y avoir surement un truc que j'ai loupé.
merci de votre aide.
Sub NbCli()
Set mondico = CreateObject("Scripting.Dictionary")
For Each c In Feuil1.Range("Q1", [Q65000].End(xlUp))
temp = c & "-" & c.Offset(, 13)
mondico(temp) = IIf(mondico.exists(temp), mondico(temp) + 1, 1)
Next c
A = mondico.keys
b = mondico.items
For i = 0 To UBound(A)
s = Split(A(i), "-")
Cells(i + 1, "Z") = s(0) & " - " & b(i) '' enlever avant ou après le "&" si pas nécessaire
Cells(i + 1, "AA") = b(i)
Next
[AA1] = "NB cli"
End Sub