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
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
Using an Average(IF statement to return values from closed external workbooks | 5 | 19 | |
Alphabetical Order for Letters | 2 | 21 | |
Excel VBA Find Lowest Column number in any range selection | 5 | 22 | |
Data Copy | 4 | 25 |
Join the community of 500,000 technology professionals and ask your questions.