Mode Function
Good morning everyone,
On an Excel Spreadsheet from D10 to D.... (more than a
thousand, I have different transit numbers written.
With the MODE Function I know which one recurs the most...
How can I find the four following ones?
There's a VBA function I use, but it still only gives me
the transit that comes back the most often... Here's the
code.....
Public Function AMM(Plg As Range) As Variant
Dim V As Variant, res As Variant, C As Variant
Dim P As String, i As Long
P = Plg.Address
V = Evaluate("=IF(COUNTIF(" & P & "," & P & _
")=MAX(IF(" & P & "<"""",COUNTIF(" & P & _
"," & P & ")))," & P & ","""")")
ReDim res(1 To 1)
i = 0
For Each C In V
If IsNumeric(C) Then
If IsError(Application.Match(C, res, 0)) Then
' enregistre seulement la première occurence
i = i + 1
ReDim Preserve res(1 To i)
res(i) = C
End If
End If
Next C
AMM = Application.Transpose(res) ' list vertically
End Function
'Daniel Maher
Could anyone help me finding the following four transits
in the range D10: D....
Thanks for your time...
Denys
|