• Resolved agendadvogado

    (@agendadvogado)


    I am inserting the formula below. However, when entering the information, only the first three formulas are being recognized. For example: if I enter a value greater than 3,500, the calculation uses the percentage of 7.5% when it should be 15%. Can someone help me please?
    Thanks!

    (function(){
            if(fieldname1 <= 1903.98) return fieldname1*0;
            if(fieldname1 >= 1903.99) return fieldname1*7.5/100-142.80;
            if(fieldname1 <= 2826.65) return fieldname1*7.5/100-142.80;
            if(fieldname1 >= 2826.66) return fieldname1*15.0/100-354.80;
            if(fieldname1 <= 3751.05) return fieldname1*15.0/100-354.80;
            if(fieldname1 >= 3751.06) return fieldname1*22.5/100-636.13;
            if(fieldname1 <= 4664.68) return fieldname1*22.5/100-636.13;
            if(fieldname1 >= 4664.69) return fieldname1*27.5/100-869.36;
            })();

    The page I need help with: [log in to see the link]

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

    (@codepeople)

    Hello @agendadvogado

    The first pair of conditions covers all the possible variants:

    
    if(fieldname1 <= 1903.98) return fieldname1*0;
    if(fieldname1 >= 1903.99) return fieldname1*7.5/100-142.80;       
    

    So, the other conditions are never reached.

    The order matters. The correct equation would be:

    
    (function () {
        if (4664.69 <= fieldname1 ) return fieldname1 * 27.5 / 100 - 869.36;
        if (3751.06 <= fieldname1) return fieldname1 * 22.5 / 100 - 636.13;
        if (2826.66 <= fieldname1) return fieldname1 * 15.0 / 100 - 354.80;
        if (1903.99 <= fieldname1) return fieldname1 * 7.5 / 100 - 142.80;
        return 0;	
    })();
    

    Best regards.

    Thread Starter agendadvogado

    (@agendadvogado)

    Boa tarde!
    Muito obrigado pela for?a!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Does not recognize formulas’ is closed to new replies.