I am trying to create a form to calculate a nutrition plan. This is the last piece of the jigsaw.
The form works of the Weight entered in lbs.
Then multiplies this value by x 10 kcal to give us the “totalcalories” field
Total calories value is then used to give us
“CaloriesProtein” totalcalories x 0.40 = ProteinCalories
This is then divided by 4 to gives us “GramsProtein”
CaloriesCarbs is calculated by totalcalories x 0.25 = CarbCalories
this is then divided by 4 to give us “GramsCarbs”
CaloriesFats is calculated by totalcalories x 0.35 = FatsCalories
this is then divided by 9 to give us "gramsFats
So here is where I need help. the Grams of food is to be divided over whatever is selected in the dropdown menu - “No.ofMeals” - values being 3,4 or 5 only.
If “No.ofMeals” selected is 5 I need the “GramsCarbohydrates” to divide by 2 and show in the last two boxes - meal 5 and meal 4 boxes.
If “No.ofMeals” selected is 4 I need the “GramsCarbohydrates” to divide by 2 and show in the boxes meals 4 and meals 3 and not to show at all in Meal 5 box.
If “No.ofMeals” selected is 3 I need the “GramsCarbohydrates” to divide by 2 and show in the boxes Meals 3 and Meals 2 and not to show in Meals 5 or 4 Boxes.