LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mode Function or MODE Function -- Can't get it to work!! JoAn Excel Discussion (Misc queries) 5 November 4th 09 12:08 AM
Mode function Guy Lydig Excel Discussion (Misc queries) 8 February 13th 08 02:41 AM
Mkae Mode function return "" instead of #N/A when there is no Mode Tonso Excel Discussion (Misc queries) 1 March 11th 07 10:38 AM
Mkae Mode function return "" instead of #N/A when there is no Mode Tonso Excel Discussion (Misc queries) 2 March 10th 07 05:10 PM
MODE function Dobbie22 Excel Worksheet Functions 2 December 10th 04 04:13 PM


All times are GMT +1. The time now is 06:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"