im trying to create a VBA built in function where if depending on the requirement, one type of calculation is done. this is what i tried to do but it is not working. anyone has an example of how do this type of function?
Public Function FRPV(ratey As Double, ratet0 As Double, maturity As Date, asof As Date, amount As Double, testif As Double)
If testif = 123 Then
FRPV = ((1 + (ratey / 100) * (maturity - asof) / 360) * amount) / (1 + (ratet0 / 100) * (maturity - asof) / 360)
Else
FRNPV = (((1 + ratey / 200) ^ ((maturity - asof) / 180)) * amount) / (1 + (ratet0 / 100) * (maturity - asof) / 360)
End If
End Function
Aucun commentaire:
Enregistrer un commentaire