Support » Plugin: Calculated Fields Form » How to use the condition "IF"

  • Resolved


    First of all, terrific plugin! I love it, thanks for it, im even considering buying it. Im very new to using it still so im a little confused. Im trying to get the condition IF to work, but i cant do it. I tried looking up at but could not find my answer.

    I have two different BMR formulas, one for males and one for females, both very different. It’d be possible to incorporate it into just 1 calculator if i could use the IF condition but i dont know how to do it, this is what i thought would work but did not:

    IF(fieldname5=men, 66 + (6.23*fieldname3) +(12.7*fieldname2) – (6.8*fieldname4), IF(fieldname5=women, 655 + (4.35*fieldname3) + (4.7*fieldname2) – (4.7*fieldname4)))

    Ill write what the fieldname means so you can understand it better:
    Fieldname5=sex, fieldname3=weight, fieldname2=height, fieldname4=age
    Thanks a lot!

    This are the formulas:
    *Men: BMR = 66 + ( 6.23 x weight in pounds ) + ( 12.7 x height in inches ) – ( 6.8 x age in years )

    *Women: BMR = 655 + ( 4.35 x weight in pounds ) + ( 4.7 x height in inches ) – ( 4.7 x age in years )

Viewing 2 replies - 1 through 2 (of 2 total)
  • Just posting again to say that i actually Solved this. Incase someone in the future has the same question as i did, this is what i did:

    (fieldname5==’men’?66:655) + ((fieldname5==’men’?6.23:4.35)*fieldname3) + ((fieldname5==’men’?12.7:4.7)*fieldname2) – ((fieldname5==’men’?6.8:4.7)*fieldname4)

    Plugin Author codepeople



    Another possible solution would be:

    return 66+fieldname3*6.23+fieldname2*12.7-fieldname4*6.8;
    return 655+fieldname3*4.35+fieldname2*4.7-fieldname4*4.7;

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to use the condition "IF"’ is closed to new replies.