Sports Possession and Territory Calculator

Rogue123

New Member
Joined
Jan 22, 2010
Messages
45
Hi All

I've been trying to set up a Sport Analysis capability for local sports clubs. Many are quite poorly funded and can't afford high end subscription based tools for doing in-game analysis for rugby and football.

I've been searching online and haven't been able to track down a free possession or territory calculator. If I may have missed something please forward the link to me :)

Otherwise, is it possible to calculate possession using VBA and some start/end buttons?

The idea is to have a button (e.g. "Team 1") that when clicked will start calculating the time Team 1 has possession. By clicking another button (e.g. "Team 2") the time under possession will stop for Team 1 and start for Team 2. Then the total percentage of time can be calculated and each teams percentage of total possession can be viewed.

As possession is exchanged, then by clicking the respective team names the total time continues so that we can see percentage of time which each team has possession at that specific point in the game.

I am no VBA specialist, so please feel free to point me in the right direction. I would like to extend this to territory as well where I can calculate the time played in a particular area of the field.

Thanks
 
Last edited:
Something along the lines of

Private Sub CommandButton1_Click()
If Range("f12") = "" Then
Range("f12") = Time()
Else
lastrow = Cells(Rows.Count, 6).End(xlUp).Row
Range("F" & lastrow).Offset(1, 0) = Time()
End If
End Sub

Private Sub CommandButton2_Click()
If Range("h12") = "" Then
Range("h12") = Time()
Else
lastrow = Cells(Rows.Count, 8).End(xlUp).Row
Range("h" & lastrow).Offset(1, 0) = Time()
End If
End Sub
 
Upvote 0
Something along the lines of

Private Sub CommandButton1_Click()
If Range("f12") = "" Then
Range("f12") = Time()
Else
lastrow = Cells(Rows.Count, 6).End(xlUp).Row
Range("F" & lastrow).Offset(1, 0) = Time()
End If
End Sub

Private Sub CommandButton2_Click()
If Range("h12") = "" Then
Range("h12") = Time()
Else
lastrow = Cells(Rows.Count, 8).End(xlUp).Row
Range("h" & lastrow).Offset(1, 0) = Time()
End If
End Sub

Thanks!

I used this and combined it with a lap counter that I found on the site as well.

Here is a the code:
Code:
Option Explicit

Public Time1 As Double,
Public Next1 As Long, N
Public lastrow As Long
Private Declare Function GetTickCount Lib "Kernel32" () As Long

Sub StartTeam1()
    Time1 = GetTickCount()
End Sub


Sub StopTeam1()
       If Range("B9") = "" Then
Range("B9") = Int(GetTickCount() - Time1) / 86400 / 1000
Else
lastrow = Cells(Rows.Count, 2).End(xlUp).Row
Range("B" & lastrow).Offset(1, 0) = Int(GetTickCount() - Time1) / 86400 / 1000
End If

End Sub

Sub Clear()
Range("B9:B220").ClearContents
Range("e9:e220").ClearContents
End Sub
   
Sub StartTeam2()
    Time1 = GetTickCount()
End Sub


Sub StopTeam2()
       If Range("e9") = "" Then
Range("e9") = Int(GetTickCount() - Time1) / 86400 / 1000
Else
lastrow = Cells(Rows.Count, 5).End(xlUp).Row
Range("e" & lastrow).Offset(1, 0) = Int(GetTickCount() - Time1) / 86400 / 1000
End If

End Sub

I have two buttons per team - one "Start" and one "Stop". Then add up the individual times for column B and then for column E.

I then work out the percentage possession for each side.

Thanks for the help :)
 
Upvote 0

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