Option Explicit
Function competition(place, judges) As Integer
Dim score As Integer
Dim tally As Integer
If place = 1 Then
score = 100
ElseIf place = 2 Then
score = 80
ElseIf place = 3 Then
score = 70
ElseIf place = 4 Then
score = 60
ElseIf place = 5 Then
score = 40
ElseIf place = 7 Then
score = 30
ElseIf place = 9 Then
score = 20
ElseIf place = 10 Then
score = 20
ElseIf place > 10 Then
score = 10
Else
score = 0
End If
If judges = 1 Then
tally = 5
ElseIf judges = 2 Then
tally = 10
ElseIf judges >= 3 Then
tally = 15
Else
tally = 0
End If
competition = score + tally
End Function
Option Explicit
Function competition(attendance, participation, placed, judged) As Integer
Dim attended As Integer
Dim participated As Integer
Dim score As Integer
Dim tally As Integer
If attendance = "y" Then
attended = 10
Else
attended = 0
If participation = "y" Then
participated = 10
Else
participated = 0
If place = 1 Then
score = 100
ElseIf place = 2 Then
score = 75
ElseIf place = 3 Then
score = 50
ElseIf place = 4 Then
score = 25
ElseIf place = 5 Then
score = 0
ElseIf place > 5 Then
score = 0
Else
score = 0
End If
If judged = 1 Then
tally = 5
ElseIf judged = 2 Then
tally = 10
ElseIf judged = 3 Then
tally = 15
ElseIf judged = 4 Then
tally = 20
ElseIf judged > 4 Then
tally = 20
Else
tally = 0
End If
competition = attended + participated + score + tally
End Function
To see this press Alt-F11. On the left of the VBA window there is a pane called Project. There you will see your file as a main entry. This will have Module as a sub entry and there will be one or more further subentries under Module. This function is probably in one of these subentries. Double click the subentry. You will see code. Search for a line which contains
Function competition(...
This is where the function is defined.