I assume x is the number I'm going to analyze and "y" is as "male" or "female" and "z" is as age group. x is a number that the result will be "underweight", healthy " or overweight". but x which is actually the BPI is not the same for male and female. eg, if x = 21 then depends on gender and age it would be categorized as either "underweight", "healthy " or overweight".

```
Function BAI(x As Integer, y As String, z As Integer) As String
If x < 21 And y = "female" And 20 <= z <= 39 Then
BAI = "UNDERWEIGHT"
Elseif 22 <= x <= 33 And y = "Female" And 20 <= z <= 39 Then
BAI = "Healthy"
ElseIf 34 <= x <= 38 And y = "Female" And 20 <= z <= 39 Then
BAI = "overweight"
ElseIf x >= 39 And y = "Female" And 20 <= z <= 39 Then
BAI = "OBESE"
ElseIf x <= 23 And y = "female" And 40 <= z <= 59 Then
BAI = "UNDERWEIGHT"
ElseIf 24 <= x <= 35 And y = "female" And 40 <= z <= 59 Then
BAI = "Healthy"
ElseIf 36 <= x <= 41 And y = "female" And 40 <= z <= 59 Then
BAI = "Overweight"
ElseIf x >= 42 And y = "female" And 40 <= z <= 59 Then
BAI = "OBESE"
ElseIf x <= 25 And y = "female" And 60 <= z <= 79 Then
BAI = "UNDERWEIGHT"
ElseIf 26 <= x <= 38 And y = "female" And 60 <= z <= 79 Then
BAI = "Healthy"
ElseIf 39 <= x <= 43 And y = "female" And 60 <= z <= 79 Then
BAI = "Overweight"
ElseIf x >= 44 And y = "female" And 60 <= z <= 79 Then
BAI = "obese"
ElseIf x <= 8 And y = "male" And 20 <= z <= 39 Then
BAI = "Underweight"
ElseIf 9 <= x <= 21 And y = "male" And 20 <= z <= 39 Then
BAI = "Healthy"
ElseIf 22 <= x <= 26 And y = "male" And 20 <= z <= 39 Then
BAI = "overweight"
ElseIf x >= 27 And y = "male" And 20 <= z <= 39 Then
BAI = "OBESE"
ElseIf x <= 11 And y = "male" And 40 <= z <= 59 Then
BAI = "UNDERWEIGHT"
ElseIf 12 <= x <= 23 And y = "male" And 40 <= z <= 59 Then
BAI = "Healthy"
ElseIf 24 <= x <= 28 And y = "male" And 40 <= z <= 59 Then
BAI = "Overweight"
ElseIf x >= 29 And y = "male" And 40 <= z <= 59 Then
BAI = "OBESE"
ElseIf x <= 13 And y = "male" And 60 <= z <= 79 Then
BAI = "UNDERWEIGHT"
ElseIf 14 <= x <= 25 And y = "male" And 60 <= z <= 79 Then
BAI = "Healthy"
ElseIf 26 <= x <= 30 And y = "male" And 60 <= z <= 79 Then
BAI = "Overweight"
End If
End Function
```