Saludos a todos, y como siempre gracias por sus respuestas.
Bueno, he estado buscando ya que realmente no logre despejar la formula y encontre esta rutina que hasta donde he visto (probado) me da los resultados comparados con unos ejemplo en Excel que tenia. Les coloco aca la función y la pagina en donde la encontre.
Function irr(cashflowA)
* IRR by Ben Creighton
* Version 1.0, 9/19/2005
*
* Returns the internal rate of return for a series of cash flows
* passed to IRR in an array.
*
* Requirements of array cashflowA
* 1. There must be at least two cash flows.
* 2. There must be at least one positive cash flow.
* 3. There must be at least one negative cash flow.
* 4. The array must be one dimensional
*
* Usage Example:
* Dimension cf(3)
* cf(1)=-100
* cf(2)=50
* cf(3)=80
* ? irr(@cf)
*
Private All
#Define precisionNC .000000001 && Precision of Result
#Define maxloopsNC 50 && Maximum Iterations
* Count Periods, Total Negative Values and Total Positive Values
Store 0 To totalPosN, totalNegN, periodsN, iterationN
For xx=1 To Alen(cashflowA)
totalPosN = m.totalPosN + Iif(cashflowA[m.xx]>0, cashflowA[m.xx], 0)
totalNegN = m.totalNegN + Iif(cashflowA[m.xx]<0, -cashflowA[m.xx], 0)
periodsN = Iif(cashflowA[m.xx]=0, m.periodsN, m.xx)
Endfor
Do Case
Case m.totalNegN=0 Or m.totalPosN=0 Or m.periodsN<2
Error "IRR: Invalid parameters in array cashflowA"
Case m.periodsN=2
* Two Period Interest Rate
irrN = (m.totalPosN / m.totalNegN - 1)
Otherwise
* Use Newton-Raphson Algorithm to Converge on irrN
Try
irrN = (m.totalPosN / m.totalNegN) ^ (1 / m.periodsN) - 1
presentValN = 1
iterationN = 0
Do While Abs(m.presentValN) > precisionNC And m.iterationN < maxloopsNC
iterationN = m.iterationN + 1
Store 0 To slopeN, presentValN
For xx = 1 To m.periodsN
presentValN = m.presentValN + cashflowA[m.xx] / (1 + m.irrN) ^ (m.xx - 1)
slopeN = m.slopeN - cashflowA[m.xx] * (m.xx - 1) / (1 + m.irrN) ^ m.xx
Endfor
irrN = m.irrN - m.presentValN / m.slopeN
Enddo
Catch
Endtry
If m.iterationN = maxloopsNC
Error "IRR: Could not Converge to a Result"
Endif
Endcase
Return m.irrN
Endfunc
Gracias señor Ben Creighton por su colaboración.