bonjour Michelrigo,
je ne suis pas sûr qu'il y a une telle fonction financielle d'Excel, donc j'ai crée une, la "MichelRigo"
Function MichelRigo(Date_Achat As Date, Date_Vente As Date, Prix_Achat As Double, Prix_Vente As Double, Mon_Coupon As Double)
Dim MesDates, MesCashFlows
ReDim Mes_Dates(0 To 1)
ReDim Mes_CashFlows(0 To 1)
Mes_Dates(0) = Date_Achat
Mes_CashFlows(0) = -Prix_Achat
For i = 1 To 1000
If UBound(Mes_Dates) < i + 1 Then
ReDim Preserve Mes_Dates(0 To i + 1)
ReDim Preserve Mes_CashFlows(0 To i + 1)
End If
x = WorksheetFunction.EDate(Date_Achat, 12 * i)
If x <= Date_Vente Then
Mes_Dates(i) = x
Mes_CashFlows(i) = Mon_Coupon
Else
i1 = i
Exit For
End If
Next
Mes_Dates(i1) = Date_Vente
Mes_CashFlows(i1) = Prix_Vente
x = WorksheetFunction.Xirr(Mes_CashFlows, Mes_Dates, 0.1)
If IsNumeric(x) Then
MichelRigo = x
Else
MichelRigo = "erreur"
End If
End Function