Reducing Increment Calculator
-
I am using the Calculated Fields Form plugin on my word press website.
I need to know how to create a calculation of some sort that will reduce the value in a box by 1 for every 2 that another number increases. and then it stops at a certain point. for example:
if your income is above £100,000 your allowance will decrease by £1 for £2 extra that you earn up to a maximum of £125,000.
at the moment i have:
fieldname78 is the result of a previous calculation.
fieldname79 is just a number field with the value £12,500 in it.
I am typing this calculation in to a different field using a calculate button provided in the plugin.
function(){
if (fieldname78 = 100000) return (fieldname79)
if (fieldname78 = 100002) return (fieldname79-1)
if (fieldname78 = 100004) return (fieldname79-2)
if (fieldname78 = 100006) return (fieldname79-3)
if (fieldname78 = 100008) return (fieldname79-4)
if (fieldname78 = 100010) return (fieldname79-5)
if (fieldname78 = 100012) return (fieldname79-6)
if (fieldname78 = 100014) return (fieldname79-7)
if (fieldname78 = 100016) return (fieldname79-8)
if (fieldname78 = 100018) return (fieldname79-9)
if (fieldname78 = 100010) return (fieldname79-5)Now short of copying and pasting this same code 25,000 times i don’t know how to just make it do what i need within the range between £100,000 and £125,000. I want the result is reduced by £1 for every £2 increase in field 78 up to a maximum of £12,500.
Please help, its been racking my brains, i have purchased the version i am using but cant seem to make it work like i want.
The topic ‘Reducing Increment Calculator’ is closed to new replies.