What is VBA PV Function
how to use it
To use VBA's PV function you need to understand its syntax and arguments:
PV(Rate, Nper, Pmt, [Fv], [Due])
- Rate: The rate of interest for the period.
- Nper: The number of periods to pay the loan or investment.
- Pmt: The fixed amount of payment per period.
- [FV]: The future value of the loan/investment [This is an optional argument and if omitted VBA takes 0 by default].
- [Due]: Defines whether the payment is due at the start or the end of the period [This is an optional argument and if omitted VBA takes the end of the period by default].
- Use 0 for the end of the period and 1 for the start of the period
Example to use PV Function in VBA
To practically understand how to use VBA PV function, you need to go through the below example where we have written a vba code by using it:
Sub example_PV() Range("A9").Value = PV(0.08 / 12, 5 * 12, -1500) End Sub
In the above code, we have used the PV to get the present value of an investment by using an 8% annual interest rate and 5 years of the time period, with a monthly payment of 1500 and it has returned 73977.65 in the result.
Below are some important points which you need to take care while using PV function in VBA.
- Both "rate" and "nper" arguments need to calculated using payment periods that are expressed in the same units.
- While using PV any cash paid out is represented by a negative number and any cash received is represented by a positive number.
About the Author
Puneet is using Excel since his college days. He helped thousands of people to understand the power of the spreadsheets and learn Microsoft Excel. You can ﬁnd him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.