Ich benutze die Harris Benedict Equation, um Leute TDEE berechnen. Ich verwende Google Tabellen, um eine Art Formular dafür zu erstellen, aber mit Google Tabellen ist es schwierig, damit zu arbeiten. Ich erhalte einen Formelanalysefehler. Die Formatierung ist ziemlich schlecht, tut mir leid.Debuggen eines Fitness-Rechners mit mehreren verschachtelten IF-Anweisungen
Ich weiß, dass ich einen kleinen Komma oder Klammerfehler irgendwo mache, aber ich bin mir nicht sicher, wo.
Der Code soll fragen, ob Menschen metrisch/imperial, männlich/weiblich, Größe, Gewicht, Aktivitätsgrad und Alter bevorzugen.
So funktioniert google sheets if statements. Es ziemlich is-
IF (A2 = "foo", "A2 ist foo")
Syntax ist
IF (logical_expression, Dann_Wert, Sonst_Wert)
=IF (D9=”Imperial”,
IF(D10=”Male”,
IF(D16=”Sedentary (no exercise)”,
66 + (6.2 x D14) + (12.7 x (D13x12+G13)) – (6.76 x D12)x1.2,
IF(D16=”Lightly Active (1-3 days of exercise/week)”,
66 + (6.2 x D14) + (12.7 x (D13x12+G13)) – (6.76 x D12)x1.375,
IF(D16=”Moderately Active (3-5 days of exercise/week)”,
66 + (6.2 x D14) + (12.7 x (D13x12+G13)) – (6.76 x D12)x1.55,
IF(D16=”Very Active(6-7 days of exercise/week)”,
66 + (6.2 x D14) + (12.7 x (D13x12+G13)) – (6.76 x D12)x1.725,
IF(D16=”Extremely Active(exercise twice a day)”,
66 + (6.2 x D14) + (12.7 x (D13x12+G13)) – (6.76 x D12)x1.9,
“ “)))))
IF(D16=”Sedentary (no exercise)”,
655.1 + (4.35 x D14) + (4.7 x (D13x12+G13)) - (4.7 x D12) x1.2,
IF(Lightly Active (1-3 days of exercise/week)”,
655.1 + (4.35 x D14) + (4.7 x (D13x12+G13)) - (4.7 x D12) x1.375,
IF(Moderately Active (3-5 days of exercise/week)”,
655.1 + (4.35 x D14) + (4.7 x (D13x12+G13)) - (4.7 x D12) x1.55,
IF(D16=”Very Active(6-7 days of exercise/week)”,
655.1 + (4.35 x D14) + (4.7 x (D13x12+G13)) - (4.7 x D12) x1.725,
IF(D16=”Extremely Active(exercise twice a day)”,
655.1 + (4.35 x D14) + (4.7 x (D13x12+G13)) - (4.7 x D12) x1.9,
“ “))))))
IF(D10=”Male”,
IF(D16=”Sedentary (no exercise)”,
66.5 + (13.75 x D14) + (5.003 x D13) – (6.755 x D12)x1.2,
IF(Lightly Active (1-3 days of exercise/week)”,
66.5 + (13.75 x D14) + (5.003 x D13) – (6.755 x D12)x1.375,
IF(Moderately Active (3-5 days of exercise/week)”,
66.5 + (13.75 x D14) + (5.003 x D13) – (6.755 x D12)x1.55,
IF(D16=”Very Active(6-7 days of exercise/week)”
66.5 + (13.75 x D14) + (5.003 x D13) – (6.755 x D12)x1.725,
IF(D16=”Extremely Active(exercise twice a day)”,
66.5 + (13.75 x D14) + (5.003 x D13) – (6.755 x D12)x1.9,
“ “)))))
IF(D16=”Sedentary (no exercise)”,
655.1 + (9.563 x D14) + (1.850 x D13) – (4.676 x D12) x1.2,
IF(Lightly Active (1-3 days of exercise/week)”,
655.1 + (9.563 x D14) + (1.850 x D13) – (4.676 x D12) x1.375,
IF(Moderately Active (3-5 days of exercise/week)”,
655.1 + (9.563 x D14) + (1.850 x D13) – (4.676 x D12) x1.55,
IF(D16=”Very Active(6-7 days of exercise/week)”,
655.1 + (9.563 x D14) + (1.850 x D13) – (4.676 x D12) x1.725,
IF(D16=”Extremely Active(exercise twice a day)”,
655.1 + (9.563 x D14) + (1.850 x D13) – (4.676 x D12) x1.9,
“ “))))))
)