football form table from results

Peterfc2

Active Member
Joined
Jan 2, 2004
Messages
402
Office Version
  1. 2013
Platform
  1. Windows
http://www.blueswayedviews.co.uk/peterfc2/capture1.jpg

Look at the link please.

What I want to happen is it to fill the data in the yellow area.
i.e. Tom has played 3 game giving W W L. (I've typed this data in to show I want.)
Anyone know how this can be done please. Tried index match but failed to sort it out.
 
You know XFD is the last column in excel 2007, am sure they didn't have that many columns in excel 2000 (Maybe 256), check what the last column is by scrolling to the extreme right and replacing the XFD in the code with the one you found
 
Last edited:
Upvote 0

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You know XFD is the last column in excel 2007, am sure they didn't have that many columns in excel 2000 (Maybe 256), check what the last column is by scrolling to the extreme right and replacing the XFD in the code with the one you found

That's sorted it! IV is last column in Excel2000. Thank you very much Momentman!
 
Upvote 0
So does the code run fully now and gives you the expected result?
 
Upvote 0
Hi
Code:
Sub fillintheresults()
    Range("L2:XFD50").ClearContents
    
    lastrow = Range("B1").End(xlDown).Row
    lastrow2 = Range("K2").End(xlDown).Row
    
    For i = 2 To lastrow2
        For j = 2 To lastrow
            lastcol = Range("xfd" & i).End(xlToLeft).Column
            If Cells(j, 2).Value = Cells(i, 11).Value Then
                Cells(i, lastcol + 1).Value = Cells(j, 8).Value
            End If
            If Cells(j, 6).Value = Cells(i, 11).Value Then
                Cells(i, lastcol + 1).Value = Cells(j, 9).Value
            End If
        Next j
    Next i
End Sub

Thought of an update to the above. Can the original be altered to make it do home form only and away form only ( Two different codes.)

Any one help please?
 
Upvote 0
Yes, we should be able to do that, how do you want the output to appear?
 
Upvote 0
Similar as before will do nicely. (Nov 8th, 2013, 06:11 PM posting)
 
Upvote 0
Something like dis. This is the output Excel 2010
BCDEFGHIJKLMN
1HomeAwayHimeResAwayRes
2tom20sumWLtomWWW
3pat22sumDDpatD
4tom32patWLsum
5pot40tomWLpotWD
6tom32patWL
7pot11sumDD
8tomL
9PatLL
10sumLDD
11pot

<colgroup><col><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet4

This is the macro I used
Code:
Sub fillintheresults()
    Range("L2:XFD50").ClearContents
    
    lastrow = Range("B1").End(xlDown).Row
    lastrow2 = Range("K2").End(xlDown).Row
    
    For I = 2 To lastrow2
        For j = 2 To lastrow
            lastcol = Range("xfd" & I).End(xlToLeft).Column
            
            found = Range("k8:k11").Find(Cells(j, 6), Range("K8")).Row
            
            If Cells(j, 2).Value = Cells(I, 11).Value Then
                Cells(I, lastcol + 1).Value = Cells(j, 8).Value
            ElseIf Cells(j, 6).Value = Cells(I, 11).Value Then
                lastcol3 = Range("XFD" & found).End(xlToLeft).Column
                Cells(found, lastcol3 + 1).Value = Cells(j, 9).Value
            End If
        Next j
    Next I
End Sub
 
Last edited:
Upvote 0
Hi, My slight altered code for 2000.
Code:
Sub latestf_Button2_Click()

    Range("L2:IV2000").ClearContents
    
    lastrow = Range("B1").End(xlDown).Row
    lastrow2 = Range("K2").End(xlDown).Row
    
    For i = 2 To lastrow2
        For j = 2 To lastrow
            lastcol = Range("iv" & i).End(xlToLeft).Column
            
            found = Range("k8:k11").Find(Cells(j, 6), Range("K8")).Row
            
            If Cells(j, 2).Value = Cells(i, 11).Value Then
                Cells(i, lastcol + 1).Value = Cells(j, 8).Value
            ElseIf Cells(j, 6).Value = Cells(i, 11).Value Then
                lastcol3 = Range("iv" & found).End(xlToLeft).Column
                Cells(found, lastcol3 + 1).Value = Cells(j, 9).Value
            End If
        Next j
    Next i
End Sub
ends at
Code:
  found = Range("k8:k11").Find(Cells(j, 6), Range("K8")).Row

Can you check it please?
 
Upvote 0
Code:
Sub latestf_Button2_Click()

    Range("L2:IV2000").ClearContents
    
    lastrow = Range("B1").End(xlDown).Row
    lastrow2 = Range("K2").End(xlDown).Row
    
    For i = 2 To lastrow2
        For j = 2 To lastrow
            lastcol = Range("iv" & i).End(xlToLeft).Column
            
            found = Range("k34:k55").Find(Cells(j, 6), Range("K34")).Row
            
            If Cells(j, 2).Value = Cells(i, 11).Value Then
                Cells(i, lastcol + 1).Value = Cells(j, 8).Value
            ElseIf Cells(j, 6).Value = Cells(i, 11).Value Then
                lastcol3 = Range("iv" & found).End(xlToLeft).Column
                Cells(found, lastcol3 + 1).Value = Cells(j, 9).Value
            End If
        Next j
    Next i
End Sub

Sorted!
Once I worked out where to display the data it was fine.
Code:
found = Range("k34:k55").Find(Cells(j, 6), Range("K34")).Row


Thanks again Momentman.
 
Upvote 0

Forum statistics

Threads
1,216,434
Messages
6,130,611
Members
449,584
Latest member
c_clark

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top