View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John John is offline
external usenet poster
 
Posts: 2,069
Default Getting duplicate names

I'm going through a list of data that I sort from highest to lowest ratings
depending on what category their in, A, B, C.... That part works fine. I then
attempt to match up names with the ratings by looping through and finding a
match to these ratings. I then concatenat the last name and first name and
place in adjacent cell. Everything works except when it comes across two
ratings that are equal. Two samples were found to be exact in League B. The
first placed the names correctly but not the second, it duplicated the name
instead of searching further into the list. Below is both programming and a
sample output of what I have. I've changed the names to protect the innocent.
:)

Sub Name_to_MVP_Player()
'
' Concatenate First name Last name

Dim myobject As Range
Dim z As Long
Dim i As Long
Dim y As Long
Dim x As Long

For y = 15 To 21 Step 2
x = 3
Do While Cells(x, y) < ""
i = 3
z = 2

Do While Cells(i, 13) < ""
If Cells(x, y) = Cells(i, 13) Then
Cells(x, y - 1) = Cells(i, 4) & " " & Cells(i, 3)
Exit Do
End If
i = i + 1
Loop
End If
x = x + 1
Loop
Next
End Sub

Col N O P Q

League A League B
Jon B 2.25000 Tom W 2.75625
Mike B 2.14881 John W 2.59740
Frank B 1.78182 Jason K 2.59740
Jim W 1.75781 Ed M 2.53125
Ralph N 1.71429 Harry B 2.50694
Dave H 0.81667 Scott S 1.92857
Jason I 0.70000 Tony C 1.50000
Ray D 0.64286 Dennis A 1.40000
Mike S 0.62500 Vicky N 1.26042
Tim W 0.40909 Vicky N 1.26042
Bethann F 0.40000 Dave C 1.06667
Rodney E 0.28571 Connie D 1.01250

I would appreciate some help on this, thanks.
--
John