• Resolved fergieferg

    (@fergieferg)


    Hey,

    I’m having difficulty getting these formulas to work based on multiple criteria.

    If the male is selected and fieldname5 has value greater than 0 I need fieldname5 to be multiplied by 1.9. If it is female the fieldname5 value should be multiplied by 1.7. And if fieldname5 <= 0 then no multiplication is needed. I’m stuck with the following, please help.

    (function(){
    IF(AND( fieldname5 > 0, fieldname1==’Male’),fieldname5*1.9);
    IF(AND( fieldname5 > 0, fieldname1==’Female’),fieldname5*1.7);
    })();

    Thanks,

    https://ww.wp.xz.cn/plugins/calculated-fields-form/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter fergieferg

    (@fergieferg)

    Got it.

    (function(){
    if(AND(fieldname5>0,fieldname1==’Male’)) return fieldname5*1.9;
    if(AND(fieldname5>0,fieldname1==’Female’)) return fieldname5*1.7;
    if(fieldname5<=0) return fieldname5*1;
    })();

    Plugin Author codepeople

    (@codepeople)

    Hi,

    Perfect, and thank you for sharing your solution, however if you have any other doubt, do not hesitate in contact me again.

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Nested If Statement’ is closed to new replies.