title: IRR calculation in Excel vs. .NET IRR calculation
body: <p>I'm trying to calculate IRR in a .NET application. The application is based on an Excel sheet that also calculates IRR. the .NET application calls the IRR function in the Microsoft.VisualBasic namespace, whereas the the Excel file uses the built in IRR function.</p>
  
  <p>Often, given the same inputs, the two functions produce different results. One example is with an initial investment of 68000 (so -68000), and then 360 received payments of 500, Excel produces an IRR of 8.3%. The .NET version will simply throw an invalid argument exception. This means that they are obviously different implementations of IRR, but is there a way to get the Excel calculation without installing Excel on the server. Or could it be possible to find out why the .NET version and Excel produce different results?</p>
  
  <p>To be clear, a number or IRR calculators fail for these same inputs. In fact, Excel is the only one I've seen that returns a value.</p>
  
  <p>The sample code is quite simple:
  IRR = Microsoft.VisualBasic.Financial.IRR(ref cashFlowArray)</p>
  
  <p>According to the documentation, this function, like Excel, uses a default guess of .1 or 10%.</p>
  
  <p>And again, one value that fails is an initial investment of -68000 and 360 received payments of 500. So the cashFlowArray has 361 values. -68000 and then 360 values of 500. Note again that this array fails in many IRR calculators, but not Excel.</p>