• Resolved svd89

    (@svd89)


    Hi Codepeople,

    How are you doing? I was wondering if you could provide me some help with the translation of the following excelformula (IF) to the ‘Advanced Equation Field’:

    IF(fieldname3=1,fieldname4*100%,fieldname4*100%,
    IF(fieldname3=2,fieldname4*70%,fieldname4*100%,
    IF(fieldname3=3,fieldname4*70%,fieldname4*100%,
    IF(fieldname3=5,fieldname4*60%,fieldname4*100%,
    IF(fieldname3=6,fieldname4*60%,fieldname4*100%,
    IF(fieldname3>=7,fieldname4*50%,fieldname4*100%))))))

    I’ve tried loads of things but unfortunately I will not be able to get it work. What am I doing wrong? I hope you can help me out. Many thanks in advance and have a good day!

    Best regards,
    Stefanie

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

    (@codepeople)

    Hello @svd89

    Your equation includes multiple errors:

    First, in javascript the operator for equality is the double symbol “==”, because the symbol “=” is used for assignment.

    Second, if you want to get the X percentage of the Y number the correct operation would be: Y*X/100 and not fieldname4*100%

    Third, the “IF” operation requires three parameters: condition, result if condition is true, and result if condition is false. In you equation you are using four parameters.

    You can nesting IF operations, but using them as one of three parameters.

    The equation could be implemented as follows:

    
    IF(fieldname3==1, fieldname4, IF(fieldname3<=3, fieldname4*0.7, IF(fieldname3<=6, fieldname4*0.6, fieldname4*0.5)))
    

    Best regards.

    Thread Starter svd89

    (@svd89)

    Yes, it works! You made my day.
    Thank you very much!

    Best regards,
    Stefanie

    Thread Starter svd89

    (@svd89)

    Hi Codepeople,

    Here I am again ??
    About the previous equation..How can I replace [fieldname4*xx] in some text?
    For example:

    IF(fieldname3==1, no discount, IF(fieldname3<=3, 30% discount, IF(fieldname3<=6, 40% discount, 50%)))

    I hope to hear from you. Many thanks in advance and have a nice weekend!

    Best regards,
    Stefanie

    Plugin Author codepeople

    (@codepeople)

    Hello @svd89

    In javascript the texts must be enclosed between single or double quotes, so the equation would be:

    
    IF(fieldname3==1, 'no discount', IF(fieldname3<=3, '30% discount', IF(fieldname3<=6, '40% discount', '50%')))
    

    Best regards.

    Thread Starter svd89

    (@svd89)

    Great! Thank you very much again!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘IF equation problem’ is closed to new replies.