Questionnaires-Scoring

  • Thread starter Thread starter Jake
  • Start date Start date
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
 
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



.
 
Back
Top