Questionnaires-Scoring

J

Jake

Lee,

For this I'd go with a select case for the gender, then
nest an if statement for the age.

Function AgeGenderScore(Age as Integer, Gender as Integer)
as Integer

Select Case Gender
Case 0 'Male
If Age >=45 and Age < 50 Then
AgeGenderScore = 5
ElseIf Age >=50 and Age < 55
AgeGenderScore = 6
ElseIf '...
End If

Case 1 'Female
If Age >=45 and Age < 50 Then
AgeGenderScore = 2
ElseIf '...
End If
End Select
End Function

Where you fill in the rest of the values under
the "ElseIf"'s.

HTH

Jake
 
L

Lee

Thanks Jake
-----Original Message-----
Lee,

For this I'd go with a select case for the gender, then
nest an if statement for the age.

Function AgeGenderScore(Age as Integer, Gender as Integer)
as Integer

Select Case Gender
Case 0 'Male
If Age >=45 and Age < 50 Then
AgeGenderScore = 5
ElseIf Age >=50 and Age < 55
AgeGenderScore = 6
ElseIf '...
End If

Case 1 'Female
If Age >=45 and Age < 50 Then
AgeGenderScore = 2
ElseIf '...
End If
End Select
End Function

Where you fill in the rest of the values under
the "ElseIf"'s.

HTH

Jake



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top