Function
Punkte(kategorieHeim
As
String
, kategorieGast
As
String
, tippHeim
As
Integer
, tippGast
As
Integer
)
Punkte = 0
Dim
i
As
Integer
i = 0
Dim
PunkteNeu
As
Integer
PunkteNeu = 0
Do
Until
IsEmpty(Spiele.Cells(i, 1))
If
Kategorie(Spiele.Cells(i, 3)) = kategorieHeim
And
Kategorie(Spiele.Cells(i, 5)) = kategorieGast
Then
PunkteNeu = PunkteSpiel(Spiele.Cells(i, 6), Spiele.Cells(i, 7), tippHeim, tippGast)
End
If
Punkte = Punkte + PunkteNeu
i = i + 1
Loop
End
Function
Function
PunkteSpiel(toreHeim
As
Integer
, toreGast
As
Integer
, tippHeim
As
Integer
, tippGast
As
Integer
)
PunkteSpiel = 0
If
Sieger(toreHeim, toreGast) = Sieger(tippHeim, tippGast)
Then
PunkteSpiel = 1
End
If
If
(toreHeim - toreGast) = (tippHeim - tippGast)
Then
PunkteSpiel = 2
End
If
If
toreHeim = tippHeim
And
toreGast = tippGast
Then
PunkteSpiel = 3
End
If
End
Function
Function
Sieger(toreHeim
As
Integer
, toreGast
As
Integer
)
If
toreHeim > toreGast
Then
Sieger = 1
End
If
If
toreHeim = toreGast
Then
Sieger = 0
End
If
If
toreHeim < toreGast
Then
Sieger = 2
End
If
End
Function
Function
Kategorie(Punkte
As
Integer
)
If
Punkte > 15
Then
Kategorie =
"A"
End
If
If
Punkte < 16
And
Punkte > 12
Then
Kategorie =
"B"
End
If
If
Punkte < 13
And
Punkte > 9
Then
Kategorie =
"C"
End
If
If
Punkte < 10
And
Punkte > 6
Then
Kategorie =
"D"
End
If
If
Punkte < 7
And
Punkte > 3
Then
Kategorie =
"E"
End
If
If
Punkte < 3
Then
Kategorie =
"F"
End
If
End
Function