The Excel NPER function calculates the number of periods required to pay off a loan, for a constant periodic payment and a constant interest rate.
The syntax of the function is:
Where the arguments are as follows:
rate    The interest rate, per period. 
pmt    The amount paid per period. 
pv    The present value of the loan. 
[fv]    An optional argument that specifies the future value of the loan, after the final payment. If omitted, [fv] takes on the default value of 0. 
[type]    An optional argument that defines whether the payment is made at the start or the end of the period. The [type] argument can have the value 0 or 1, meaning: 0  the payment is made at the end of the period; 
Cash Flow Sign Convention:
Note that, in line with the general cash flow sign convention, outgoing cash flows are represented by negative numbers and incoming cash flows are represented by positive numbers. This is seen in the examples below.In the following spreadsheet, the Excel Nper function is used to calculate the number of years required to pay off in full, a loan of $50,000 at a rate of $6,000 per year. Interest is charged at a rate of 4% per year, and the payment to the loan is to be made at the end of each year.
Formula:
 Result:

Note that in this example:
In the example below, the Excel Nper function is used to calculate the number of quarterly payments of $2,000 that are required to reduce a loan of $60,000 to $30,000. Interest is charged at a stated rate of 6% per year and the payment to the loan is to be made at the beginning of each quarter.
Formula:
 Result:

Note that, in this example:
Further examples of the Excel Nper function are provided on the Microsoft Office website.
If you get an error from the Nper function, this is likely to be one of the following:
#NUM!    Occurs if the specified future value will never be met for the supplied periodic interest rate and payments. You may need to increase the payment amount or reduce the interest rate to get a valid result. 
#VALUE!    Occurs if any of the supplied arguments are not recognised as numeric values. 
Also, the following problem is encountered by some users:
The Excel NPER function gives a negative result, when a positive one is expected.
This problem usually occurs when the present value and the specified periodic payment both have the same arithmetic sign. If a loan is being paid off, present value should be negative and the payment should be positive (or vice versa).
Ensure that all arithmetic signs follow the Cash Flow Sign Convention.