[−][src]Function finance_solution::nper
pub fn nper<C: Into<f64> + Copy, P: Into<f64> + Copy, F: Into<f64> + Copy>(
periodic_rate: f64,
payment: C,
present_value: P,
future_value: F
) -> f64
Returns the number of periods required for an annuity (payments) to reach a future value, at a specified periodic rate. Still in beta.
Related functions:
- To calculate nper while retaining the input values use
nper_solution
.
The NPER formula is:
Number of Periods = LN( (payment - future_value * periodic_rate) / (payment + present_value * periodic_rate) ) / LN(1 + periodic_rate)
...where LN is the natural log (log10).
Arguments
periodic_rate
- The rate at which the investment grows or shrinks per period, expressed as a floating point number. For instance 0.05 would mean 5% growth. Often appears asr
ori
in formulas.payment
- The payment amount per period, also referred to as an annuity or cashflow. In this formula, it must be negative, and future value must be positive. Often payment appears aspmt
orC
(cashflow) in formulas.present_value
- The present value, or total value of all payments now. Often appears aspv
in formulas.future_value
- The future value, a cash balance after the last payment is made and interest has accrued in each period. Often appears asfv
in formulas.
Panics
The call will fail if payment
is greater than or equal to 0, because the formula requires payment
to be negative.
Additionally, present_value
and future_value
must be positive, or 0. However, both present_value
and future_value
cannot be 0, at least one value must be set.
Returns f64 for Number of Periods (NPER). Receive the number of periods required for a present value to equal a future value based on a set of payments at an interest rate. If there is no initial present value, use 0. This is equivalent to the NPER function in Excel / Google Sheets.