nitroman84
Technical User
Hello, I'm still very green in programming with Fortran.
I have hit a brick wall in an If Statement in my program.
I am making a calculator to simplify caloric intake needs based on body fat % and lean body mass.
Caloric need is calculated as body fat % 6 to 13 Multiply LBM * 12,
body fat % 14 to 19 Multiply LBM * 11 and body fat % 20 and above Multiply LBM * 10
Here is the If Statement:
!BFPcent is body fat percent
!CF is Caloric Formula
!LeanBM is Lean body mass
If (BFPcent <= 13) Then
CF = (LeanBM * 12)
Else If (BFPcent >= 14) Then
CF = (LeanBM * 11)
Else If (BFPcent >=20) Then
CF = (LeanBM * 10)
End If
The code does work however the >= 14 seems to cancel out the >= 20 so no matter what figure I put in higher than 19 is still being calculated at 11 instead of 10.
Any help would be greatly appreciated.
Thanks
I have hit a brick wall in an If Statement in my program.
I am making a calculator to simplify caloric intake needs based on body fat % and lean body mass.
Caloric need is calculated as body fat % 6 to 13 Multiply LBM * 12,
body fat % 14 to 19 Multiply LBM * 11 and body fat % 20 and above Multiply LBM * 10
Here is the If Statement:
!BFPcent is body fat percent
!CF is Caloric Formula
!LeanBM is Lean body mass
If (BFPcent <= 13) Then
CF = (LeanBM * 12)
Else If (BFPcent >= 14) Then
CF = (LeanBM * 11)
Else If (BFPcent >=20) Then
CF = (LeanBM * 10)
End If
The code does work however the >= 14 seems to cancel out the >= 20 so no matter what figure I put in higher than 19 is still being calculated at 11 instead of 10.
Any help would be greatly appreciated.
Thanks