Need help with a formula.
Hello,
I am trying to do something with a pre-existing formula but haven't been able to get it working. Right now I have the formula...
var DV = this.getField("15 Depreciated Value");
var age = this.getField("Age");
var AC = this.getField("14 Acquisition Cost");
var DR = AC.value/60;
- DV.value = 0;
- DV.value = AC.value - (DR*age.value);
if(DV.value<0) DV.value=0;
if(DV.value>=500) DV.textColor =color.red;
if (DV.value<500) DV.textColor=color.black;
But it doesn't do everything I need. Right now it calculates depreciated value every month, but I need it to do it differently. I tried adding the below code...
if (Age.value<=12) DV.value=AC.value*0.7
if (Age.value>=24) DV.value=AC.value*0.4
if (Age.value>=36) DV.value=AC.value*0.2
if (Age.value>=48) DV.value=AC.value*0.1
if (Age.value>=60) DV.value=AC.value*0.05
To adjust the Depreciated Value better but it doesn't seem to work.
I'm trying to do something like...
Depreciated Value = Acquisition Cost * 0.7 if Age is 01-12
Depreciated Value = Acquisition Cost * 0.4 if Age is 13-24
Depreciated Value = Acquisition Cost * 0.2 if Age is 25-36
Depreciated Value = Acquisition Cost * 0.1 if Age is 37-48
Depreciated Value = Acquisition Cost * 0.05 if Age is greater than 49
Any help would be greatly appreciated! Thank you for your time and assisatnace!