View Single Post
  #5   Report Post  
Bernie Deitrick
 
Posts: n/a
Default Joint ranking (never seen a satisfactory answer!)

Function Top(Scores As Range, Names As Range) As String
Dim i As Integer
Dim oldi As Integer
Dim myMax As Double
myMax = Application.Max(Scores)
i = Application.Match(myMax, Scores, False)
On Error GoTo AllFound
Start:
If Top = "" Then
Top = Names(i).Value
Else
Top = Top & " and " & Names(i).Value
End If
oldi = i
i = Application.Match(myMax, Scores.Offset(i, 0). _
Resize(Scores.Cells.Count - i), False)
i = i + oldi
GoTo Start
AllFound:
If InStr(1, Top, " and ") 0 Then
Top = Top & " - " & myMax & " each"
Else
Top = Top & " - " & myMax
End If
End Function

HTH,
Bernie
MS Excel MVP


wrote in message oups.com...
Let's make this even harder then....

I was wondering if it was possible to say

Top CVs: Peter and Paul - 9 each
Top Jobs: Jason and Jim and Lewis - 6 each

etc?