samedi 2 juillet 2016

Google sheets Fitness calculator not working

I'm using the Harris Benedict Equation to calculate people's TDEE. I'm using Google Sheets to create a sort of form for this but Google sheets is sort of difficult to work with. I'm getting a formula parse error. Formatting is pretty bad sorry about that.

I know I'm making a small comma or parenthesis error somewhere but I'm not sure where.

The code is supposed to ask if people prefer metric/imperial, male/female, height, weight, activity level, and age.

Here's how google sheets does if statements. It pretty much is-

IF(A2 = "foo","A2 is foo")

Syntax is

IF(logical_expression, value_if_true, value_if_false)

=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,

                                            “ “))))))

    )

Aucun commentaire:

Enregistrer un commentaire