View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Rich DeVito Rich DeVito is offline
external usenet poster
 
Posts: 3
Default count array for top three entries and return their number

Thanks Otto!

I will try this. Now let me confuse the situation...I need the 1st, 2nd and
3rd place winners. Sorry, I forgot to mention this on the first pass
question. I will try this and see if I can get it to work. The other
solution was graphical using a graphical function list a distribution bar
code.

Thank you!

"Otto Moehrbach" wrote:

Rich
I assumed you have only one row of data and it's in row 1 starting in
A1. This macro will produce a message box telling you the winner and how
many votes for that winner. Post back if you need more or if my assumptions
are wrong. HTH Otto
Sub GetBest()
Dim rRngRow1 As Range, i As Range
Dim HowMany As Long, What As Long
HowMany = 0
Set rRngRow1 = Range("A1", Cells(1, Columns.Count).End(xlToLeft))
For Each i In rRngRow1
If Application.CountIf(rRngRow1, i.Value) HowMany Then
HowMany = Application.CountIf(rRngRow1, i.Value)
What = i.Value
End If
Next i
MsgBox "Car number: " & What & Chr(13) & _
"How many: " & HowMany
End Sub
"Rich DeVito" wrote in message
...
I am trying to solve a scoring problem for a car show.

In a spread sheet we will have entry number of cars running across columns
that represent individual 1st place choices. Without filtering and
resorting
the data (no time at the car show) I need to dynamically determine the top
three entires and return the number of times they show up. I.E if these
are
the car entry numbers in their respective columns.

1 2 1 3 2 4 2 4 1 1 1 4 2

Should return
1 5
2 4
4 3
I don't even need the second number (number of votes, but we probably need
it to verify the formula is working).

Thanks!!