Overall rankings updating automatically after entering new data?

dartistik

New Member
Joined
May 22, 2017
Messages
16
Hello all,

I'm not that great with Excel, so not sure if this is possible at all (or just very complicated), but here goes.

I'm doing rankings for darts players in the Danish leagues, and I've got the the overall rankings in sheet 1 and then I create a new sheet for every day matches are played. What I'd like is that the sheet with the overall rankings recognizes the license number (a unique ID) of the players when I enter their data in another sheet for each day, and then adds the data from that to the data in the overall rankings.

The way I'm doing it at the moment I have to manually find every player in the overall rankings and then add the numbers for hundreds of players each time.

Here's a screenshot of the overall rankings sheet from a test workbook I'm working on for next season, results from the 1st day have been put in:

2w3u7g8.png


I then create new sheets for each day matches are being played:

2l8eux4.png


And when I put in the data from that particular day, I'd ideally like for the overall rankings sheet to add the numbers in column G, H, J, K and P in these sheets:

16i9ybn.png


...to the corresponding colomns H, I, K, L and R for each player in the overall rankings sheet. The rest of the columns are calculated by formulas.

In essence, using Excel as a kind of database, so I don't have to manually add all the numbers to each and every player after every day they've played. Like I said, not sure if it's possible at all, and probably there'll be a problem when a new player than wasn't on the overall rankings previously plays on a given day too.

Let me know if I'm just daydreaming here :cool:
 
May be I guessed what you did. Did you put macro in a different workbook to keep your workbook extension as xlsx? It is the only thing that could rise that error.

Here the code with amendments:

Code:
Option Explicit
Sub updateSR()
Dim y As String
Dim x As Long
Dim z As Long
Dim dayWS As Worksheet
Dim SRWS As Worksheet
Dim myrange As Range
Dim FOUND As Boolean
Dim lrdayWS As Long
Dim lrSR As Long

Set myrange = Application.InputBox(prompt:="select a cell in sheet to integrate", Type:=8)
y = myrange.Worksheet.Name
Set dayWS = Worksheets(y)
Set SRWS = Worksheets("Samlet rangliste")
lrdayWS = dayWS.Cells(Rows.Count, 3).End(xlUp).Row
 For x = 4 To lrdayWS
    lrSR = SRWS.Cells(Rows.Count, 4).End(xlUp).Row
    FOUND = False
    For z = 4 To lrSR
    'FOUND = False
        If dayWS.Cells(x, 3).Value = SRWS.Cells(z, 4).Value Then
            SRWS.Cells(z, 4).Offset(0, 4).Value = SRWS.Cells(z, 4).Offset(0, 4).Value + dayWS.Cells(x, 3).Offset(0, 4).Value
            SRWS.Cells(z, 4).Offset(0, 5).Value = SRWS.Cells(z, 4).Offset(0, 5).Value + dayWS.Cells(x, 3).Offset(0, 5).Value
            SRWS.Cells(z, 4).Offset(0, 7).Value = SRWS.Cells(z, 4).Offset(0, 7).Value + dayWS.Cells(x, 3).Offset(0, 7).Value
            SRWS.Cells(z, 4).Offset(0, 8).Value = SRWS.Cells(z, 4).Offset(0, 8).Value + dayWS.Cells(x, 3).Offset(0, 8).Value
            SRWS.Cells(z, 4).Offset(0, 14).Value = SRWS.Cells(z, 4).Offset(0, 14).Value + dayWS.Cells(x, 3).Offset(0, 13).Value
            FOUND = True
        End If
    Next z
        If FOUND = False Then
            SRWS.Range([COLOR=#ff0000]SRWS.[/COLOR]Cells(lrSR, "B"), [COLOR=#ff0000]SRWS.[/COLOR]Cells(lrSR + 1, "V")).FillDown
            SRWS.Range([COLOR=#ff0000]SRWS.[/COLOR]Cells(lrSR, "B"), [COLOR=#ff0000]SRWS.[/COLOR]Cells(lrSR + 1, "P")).Borders(xlInsideHorizontal).Weight = xlThin
            SRWS.Cells(lrSR + 1, 3).Value = SRWS.Cells(lrSR, 3).Value + 1
            SRWS.Cells(lrSR + 1, 4).Offset(0, 0).Value = dayWS.Cells(x, 3).Offset(0, 0).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 1).Value = dayWS.Cells(x, 3).Offset(0, 1).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 2).Value = dayWS.Cells(x, 3).Offset(0, 2).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 4).Value = dayWS.Cells(x, 3).Offset(0, 4).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 5).Value = dayWS.Cells(x, 3).Offset(0, 5).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 7).Value = dayWS.Cells(x, 3).Offset(0, 7).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 8).Value = dayWS.Cells(x, 3).Offset(0, 8).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 14).Value = dayWS.Cells(x, 3).Offset(0, 13).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 16).Value = ""
            SRWS.Cells(lrSR + 1, 4).Offset(0, 18).Value = ""
        End If
 Next x
End Sub

As a suggestion, move range from M49:O50 to AA10:AC11 and change formulas from =(SUM(R4:R47))/(SUM(K4:K47)) to =(SUM(R:R))/(SUM(K:K)) and =AVERAGE(O4:O47) to =AVERAGE(O:O)

There are minor amendments for new player.
Hope this helps and you like
Have a nice week
 
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)
What about inserting this line of code before the end of last IF block?
Code:
            SRWS.Cells(lrSR + 1, 4).Offset(0, 12).Value = "NEW"

Cheers
 
Last edited:
Upvote 0
B___P, you are an absolute genius.

It works great now:

Unavngivet_8.png


Could I ask you for one more small amendment? When it adds new players to the list, could you make it put a - in columns T and V (like I have added in the screenshot above)?

Thanks again for your excellent work!
 
Upvote 0
Hi dartistik,

here the full code with required amendments

Code:
Option Explicit
Sub updateSR()
Dim y As String
Dim x As Long
Dim z As Long
Dim dayWS As Worksheet
Dim SRWS As Worksheet
Dim myrange As Range
Dim FOUND As Boolean
Dim lrdayWS As Long
Dim lrSR As Long

Set myrange = Application.InputBox(prompt:="select a cell in sheet to integrate", Type:=8)
y = myrange.Worksheet.Name
Set dayWS = Worksheets(y)
Set SRWS = Worksheets("Samlet rangliste")
lrdayWS = dayWS.Cells(Rows.Count, 3).End(xlUp).Row
 For x = 4 To lrdayWS
    lrSR = SRWS.Cells(Rows.Count, 4).End(xlUp).Row
    FOUND = False
    For z = 4 To lrSR
    'FOUND = False
        If dayWS.Cells(x, 3).Value = SRWS.Cells(z, 4).Value Then
            SRWS.Cells(z, 4).Offset(0, 4).Value = SRWS.Cells(z, 4).Offset(0, 4).Value + dayWS.Cells(x, 3).Offset(0, 4).Value
            SRWS.Cells(z, 4).Offset(0, 5).Value = SRWS.Cells(z, 4).Offset(0, 5).Value + dayWS.Cells(x, 3).Offset(0, 5).Value
            SRWS.Cells(z, 4).Offset(0, 7).Value = SRWS.Cells(z, 4).Offset(0, 7).Value + dayWS.Cells(x, 3).Offset(0, 7).Value
            SRWS.Cells(z, 4).Offset(0, 8).Value = SRWS.Cells(z, 4).Offset(0, 8).Value + dayWS.Cells(x, 3).Offset(0, 8).Value
            SRWS.Cells(z, 4).Offset(0, 14).Value = SRWS.Cells(z, 4).Offset(0, 14).Value + dayWS.Cells(x, 3).Offset(0, 13).Value
            FOUND = True
        End If
    Next z
        If FOUND = False Then
            SRWS.Range(SRWS.Cells(lrSR, "B"), SRWS.Cells(lrSR + 1, "V")).FillDown
            SRWS.Range(SRWS.Cells(lrSR, "B"), SRWS.Cells(lrSR + 1, "P")).Borders(xlInsideHorizontal).Weight = xlThin
            SRWS.Cells(lrSR + 1, 3).Value = SRWS.Cells(lrSR, 3).Value + 1
            SRWS.Cells(lrSR + 1, 4).Offset(0, 0).Value = dayWS.Cells(x, 3).Offset(0, 0).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 1).Value = dayWS.Cells(x, 3).Offset(0, 1).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 2).Value = dayWS.Cells(x, 3).Offset(0, 2).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 4).Value = dayWS.Cells(x, 3).Offset(0, 4).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 5).Value = dayWS.Cells(x, 3).Offset(0, 5).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 7).Value = dayWS.Cells(x, 3).Offset(0, 7).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 8).Value = dayWS.Cells(x, 3).Offset(0, 8).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 14).Value = dayWS.Cells(x, 3).Offset(0, 13).Value
            SRWS.Cells(lrSR + 1, 4).Offset(0, 16).Value = "-"
            SRWS.Cells(lrSR + 1, 4).Offset(0, 18).Value = "-"
            SRWS.Cells(lrSR + 1, 4).Offset(0, 12).Value = "NEW"
        End If
 Next x
End Sub

Hope you like it

Cheers
 
Last edited:
Upvote 0
Hi B___P,

Just wanted to thank you again - you have saved me quite a few hours of work over the next year or so! As far as I can see it now does everything I want perfectly :)

Best regards
 
Upvote 0

Forum statistics

Threads
1,223,989
Messages
6,175,812
Members
452,671
Latest member
jowalker82

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