How do I calculate Excel’s XIRR function using C#?
How do I calculate Excel’s XIRR function using C#?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
According to XIRR function openoffice documentation (formula is same as in excel) you need to solve for XIRR variable in the following f(xirr) equation:

You can calculate xirr value by:
f(xirr)andf'(xirr)you can solve for xirr value by using iterative Newton’s method – famous formula->EDIT
I’ve got a bit of time so, here it is – complete C# code for XIRR calculation:
BTW, keep in mind that not all payments will result in valid XIRR because of restrictions of formula and/or Newton method!
cheers!