Function Classement(tablo, Optional ncite&)
Dim a(), d As Object, e, b, c, i&, n&
tablo = tablo 'matrice, plus rapide
ReDim a(1 To Application.Caller.Columns.Count)
If ncite Then
Set d = CreateObject("Scripting.Dictionary")
For Each e In tablo
If e <> "" Then d(e) = d(e) + 1 'comptage
Next
If d.Count Then
b = d.keys: c = d.items
For i = 0 To UBound(b)
If c(i) = ncite Then
n = n + 1
a(n) = b(i)
End If
Next
End If
Else
For Each e In tablo
If e <> "" Then
n = n + 1
a(n) = e
End If
Next
End If
For i = n + 1 To UBound(a)
a(i) = "" 'évite les valeurs zéros
Next
Classement = a 'vecteur ligne
End Function