XNPV calculates the net present value of an investment. The schedule of the cash flows is given in @dates array. The first date indicates the beginning of the payment schedule. @rate is the interest rate and @values are the payments.
If @values and @dates contain unequal number of values, XNPV returns the #NUM! error.