Preview

Vba Bond Function

Satisfactory Essays
Open Document
Open Document
777 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Vba Bond Function
Homework #1 [Problem 4] Bond Price

I discussed after class some ideas as to how to go about building the Bond Price function. This is problem 4 of the first homework assignment. There are three functions that have to be built. This is stated in the problem. The three functions are a function to calculate the present value interest factor for a single value. The second function returns a calculation of the present value interest factor of an annuity. The third function utilizes the first two functions in calculating the fair value of a bond, and returns the fair value or the theoretical price of the bond given a required rate of return. The first step would be to name the three functions. We can go ahead and create “empty” or “shell” functions. Let’s assume we have decided to name the three functions: 1) BondFairValue() 2) PVIF() 3) PVIFA() So in our module, we make three shell functions. We know that each of the functions will have to return a value that includes decimals so we set to type “Single” the values the functions return. ‘ 1st Function Declaration Function BondFairValue() As Single BondFairValue = 0

End Function ‘ 2nd Function Declaration Function PVIF() As Single PVIF = 0

End Function ‘ 3rd Function Declaration Function PVIFA() As Single PVIFA = 0

End Function ‘ *********************************************************** Notice I have created these functions with a return value. Each function returns the value zero. It is a test value. This way if you were using them in a more complex environment you could add them to your

code and insure the functions were being called or “executed” correctly. Eventually you need to replace the zeros with actual calculations. Also the order that you create the functions, i.e. which one is created first does not matter. Next, think about what are the required parameters. We know that PVIF, and PVIFA both have two parameters. So first we’ll edit the

You May Also Find These Documents Helpful