Financial Calculations

rnewell

New Member
Hi,

I am new to this Progress 4GL and was looking but unable to find a function like the present value “(PV(rate,nper,pmt,fv,type)” function in Excel. Is there one or is there another solution?

Thanks,

Ron
 

dkellgren

Member
This "function" gives you the PMT equiv:

RETURNS DECIMAL
(INPUT Cost AS INTEGER,
INPUT Rate AS DECIMAL,
INPUT NPer AS DECIMAL) :

DEF VAR IRate AS DECIMAL.
DEF VAR R1 AS DECIMAL.
DEF VAR Power AS DECIMAL INITIAL 1.0.
DEF VAR Sum AS DECIMAL INITIAL 0.0.
DEF VAR Ratio AS DECIMAL.
DEF VAR Payment AS DECIMAL.
DEF VAR TermLoop AS INTEGER INITIAL 0.
DEF VAR FinalVal AS DECIMAL.

NPer = NPer * 12.0.
IRate = Rate / 1200.0.
R1 = IRate + 1.

REPEAT TermLoop = 1 TO NPer:
Power = Power * R1.
Sum = Sum + Power.
END.

Power = Power * R1.
Ratio = Power / Sum.
Payment = Cost * Ratio.
FinalVal = ((100 * Payment) / 100).

RETURN FinalVal.


END FUNCTION.

Sample input values: 50000 (principal), 7.0 (Interest Rate), 5.0 (Term in Years).

This is slightly different because of the way the inputs are - but you can mod it from there.

Wish I had those other functions too though!

HTH

-dk-
 
Top