• Resolved cansnips

    (@cansnips)


    I’m trying to replicate the following in excel on CFF

    =IF((H18*H26)-1000<=0, “”, (H18*H26)-1000)

    in CFF I currently have this
    PREC(fieldname7*fieldname16-1000, 2)

    So H18 is fieldname7 and H26 is fieldname16

    But I’m struggling to action the IF part in CFF

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @cansnips

    The code would be very similar:

    
    IF(fieldname7*fieldname16-1000<=0, '', PREC(fieldname7*fieldname16-1000, 2))
    

    Best regards.

    Thread Starter cansnips

    (@cansnips)

    brilliant, thank you

    Hello,

    When dealing with IF statements, how can possibly do this?

    If the calculated BMI is within 18.5 – 24.9, my html content field would say:
    You’re at Normal weight
    If the calculated BMI is within 25 – 29.9, my html content field would say:
    You’re Overweight.

    I was able to do this type of condition with an easier one (actual BMI), using this:

    (function(){
    var result = prec(fieldname6/fieldname1, 2);
    jQuery('#result_here').html(result);
    return result;
    })();

    HTML content:

    <p>Based on your Height and Weight, your BMI is <span id="result_here"></span>.
    </p>

    But where I’m struggling at is at saving and showing a certain verbiage when a condition on the BMI value is met.

    • This reply was modified 5 years, 8 months ago by jfool.
    • This reply was modified 5 years, 8 months ago by jfool.
    Plugin Author codepeople

    (@codepeople)

    Hello @jfool

    The equation should be edited as follows:

    
    (function(){
    var result = fieldname6/fieldname1, mssg = "";
    
    if(AND(18.5<=result, result<=24.9)) mssg = "You're at Normal weight";
    else if(AND(24.9<result, result<=29.9)) mssg = "You're Overweight";
    
    jQuery('#result_here').html(mssg);
    return PREC(result, 2);
    })();
    

    Best regards.

    Thank you so much!

    How about when I will combine the BMI and mssg in one blurb? Let’s say:
    Based on your Height and Weight, your BMI is *result* = *mssg* (Asia-Pacific)

    Is that doable?

    • This reply was modified 5 years, 8 months ago by jfool.
    Plugin Author codepeople

    (@codepeople)

    Hello @jfool

    You can call the CONCATENATE operation passing both values as parameters.

    Best regards.

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

The topic ‘IF operation’ is closed to new replies.