• Resolved anefarious1

    (@anefarious1)


    Hello. I’m creating a fee calculator and I want to give users the option to determine fees based on an entered amount.

    For example:

    A 5.0% fee on 100 would be 95 net

    But what about if they wanted to receive 100 net of fees. The answer is 105.26 to arrive at 100 after fees, but how would I structure this? I want to give users the option to calculate it either way, 100/95 and 105.26/100

    Thank you!

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

    (@codepeople)

    Hello @anefarious1

    As you said, it is mathematics. If you have a currency field in the form for entering the Net the user wants to receive, for example, the fieldname1, and the percentage is 5%, the equation associated with the calculated field would be:

    fieldname1*100/95

    If you want the result with two decimal places:

    PREC(fieldname1*100/95, 2)

    If the percentage is entered by the user or calculated through another field, for example the fieldname2, the equation would be:

    PREC(fieldname1*100/(100-fieldname2), 2)

    Best regards.

    Thread Starter anefarious1

    (@anefarious1)

    I’m sorry I should have explained it better.

    So the user cannot enter the fee rate (percent). It’s predetermined, set.

    And my equation is:

    if(fieldname3 == 1) return PREC(fieldname2*0.05, 2);

    This gives the user the 5 fee based on 100 entered. Very easy!

    But I need another separate field that outputs, for this example, 105.26 which is the amount that is needed for 100 net of the 5% fee. Do you know what this equation would be?

    I hope that makes sense.

    Thread Starter anefarious1

    (@anefarious1)

    I figured it out! Thank you!

    Plugin Author codepeople

    (@codepeople)

    Excellent !!!!!

    Best regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Trying To Create a Reverse Calculator’ is closed to new replies.