Support » Plugin: Calculated Fields Form » Multiple IF statements for one form?

• This IF statement works:

`IF(AND(fieldname2 == 'C276', fieldname3 == '.250', fieldname4 == '26,063'), ".035"," ")`

I would like to include another IF statement in this equation for when fieldname4 = another value. The singular equation would be:

``````
IF(AND(fieldname2 == 'C276', fieldname3 == '.250', fieldname4 == '38,044'), ".049","”)``````

This does not work:

``````IF(AND(fieldname2 == 'C276', fieldname3 == '.250', fieldname4 == '26,063'), ".035","");
IF(AND(fieldname2 == 'C276', fieldname3 == '.250', fieldname4 == '38,044'), ".049","”);``````

Is there a specific way to write these two statements to have them both work?

Thanks so much!

Viewing 2 replies - 1 through 2 (of 2 total)
• Hello @snucker0

You have two alternatives:

You can nesting the `IF` operations:

`IF(AND(fieldname2 == 'C276', fieldname3 == '.250', fieldname4 == '26,063'), ".035",IF(AND(fieldname2 == 'C276', fieldname3 == '.250', fieldname4 == '38,044'), ".049",""));`

Or you can use `if` conditional statements and `function` structure:

``````(function(){
if(AND(fieldname2 == 'C276', fieldname3 == '.250', fieldname4 == '26,063')) return 0.035;
if(AND(fieldname2 == 'C276', fieldname3 == '.250', fieldname4 == '38,044')) return 0.049;

return '';
})()``````

Best regards.

Hi @codepeople ,
Thank you so much for your quick response. Worked like a charm. I very much appreciated you providing both options.
All the best

Viewing 2 replies - 1 through 2 (of 2 total)
• The topic ‘Multiple IF statements for one form?’ is closed to new replies.