Excel formula which returns the internal rate of return for a schedule of cash flows
Questions tagged [xirr]
44 questions
8
votes
2 answers
Including a non-adjacent cell in a Range (series) in the XIRR formula
I am using the XIRR formula as follows:
=XIRR(E$11:E17,B$11:B17)
but need to add an additional non-adjacent cell to the Range of values and dates.
My first attempt:
=XIRR((E$11:E17,H17),(B$11:B17,B17))
resulted in #VALUE
I have attempted to do it…

Harrison
- 3,843
- 7
- 22
- 49
5
votes
1 answer
Formula Evaluator for XIRR function in Java
Facing issue with reading a cell in excel which is set with XIRR function.
I written my code in Java. Below is the code to set the formula. Please help on how can I read the value from the cell and not the formula.
cell.setCellFormula("XIRR(E2:E10,…

sras
- 818
- 7
- 18
3
votes
2 answers
java program to calculate XIRR without using excel or any other library
My application have to calculate XIRR, but I cannot use excel, because it runs on Linux, can any one share the logic or java code to calculate XIRR without using excel.

sskini
- 89
- 1
- 11
2
votes
2 answers
Error in uniroot while calculating XIRR in R
Reproducible example:
v <- c(-400000.0,-200000.0, 660636.7)
d <- c("2021-10-27","2022-12-23","2023-01-04")
d1 <- as.Date(d, format="%Y-%m-%d")
tvm::xirr(v, d1) # gives the error below
Error in uniroot(xnpv, interval = interval, cf = cf, d = d, tau…

ottodidakt
- 3,631
- 4
- 28
- 34
2
votes
1 answer
Dates in dd/mm/yyyy format return 1004 Error in Excel Vba
I have this code, and it works:
Sub try3()
Dim dates(1 To 2) As Date
Dim values(1 To 2) As Double
Dim TIR As Double
dates(1) = #1/1/2015#
dates(2) = #1/1/2016#
values(1) = -1000
values(2) = 1101
TIR = Application.WorksheetFunction.xirr(values,…

David R
- 55
- 7
2
votes
1 answer
How to use Javascript class for xirr formula
Hello I have found a javascript class for some excel functions but i dont know how to use it. I need to use XIRR function but i dont know the type and format of parameters and the syntax.
Here is the code:
/* Based on
* - EGM Mathematical Finance…

user3257272
- 21
- 1
- 3
2
votes
1 answer
XIRR Calc in SQL
I'm trying to find a decent implementation of excels XIRR calculation in SQL.
I found the following function online:
CREATE TYPE dbo.MyXirrTable AS TABLE
(
theValue DECIMAL(19, 9) NOT NULL,
theDate DATETIME NOT…

woggles
- 7,444
- 12
- 70
- 130
1
vote
1 answer
Preview Table created by DAX before it's passed into XIRR function - DAX Debugger
We've been trying to use the XIRR function in PowerBI, and trying all sorts of things over the better course of a month to get it to work. And we did, finally, get the XIRR function to stop erroring out. And it returns IRRs that seem reasonable…

Tucker Moore
- 31
- 3
1
vote
1 answer
To find XIRR for different investments using google sheet
I am currently trying to calculate the XIRR of a huge portfolio containing non-periodic cashflows. The database contains lot of transactions and I want to calculate the XIRR for each one.
This image contains the format and the last column contains…

Shawnshaw
- 17
- 1
- 5
1
vote
0 answers
'Newton-Raphson algorithm failed to converge'
I am trying to calculate xirr using the node xirr library but I am getting error that
Error: Newton-Raphson algorithm failed to converge
const xirr = require('xirr');
const cagr = xirr([
{ amount: -99995, when: new Date(2021, 7, 3)},
{ amount:…

Coder_m
- 51
- 4
1
vote
1 answer
Relative Range in the Row of a Formula
I have been struggling with a macro for over a month now. The goal is to break up data by security identifier (in column C) by inserting a row every time the value in the column changes. Afterwards, I want to insert an XIRR formula in the blank row…

Manny
- 13
- 2
1
vote
1 answer
Python IRR Function giving different result than Excel XIRR
I am using the following functions to perform IRR-Calculations with Python:
from scipy.optimize import newton
def xnpv(rate, values, dates):
if rate <= -1.0:
return float('inf')
min_date = min(dates)
return sum([
…

Daniel
- 963
- 1
- 12
- 29
1
vote
1 answer
Calculate XIRR for mutual fund transactions in Python
I knew that my question is answered here ..financial python library that has xirr and xnpv function?..
def xirr(transactions):
years = [(ta[0] - transactions[0][0]).days / 365.0 for ta in transactions]
residual = 1
step = 0.05
guess…

Prats
- 53
- 1
- 8
1
vote
1 answer
How to loop the xirr function in r over multiple ID's
I want to calculate the IRR (using the xirr function from package tvm) for each ID in a table where each ID has a different number of rows. I believe I have to use first occurrence to last occurrence-1, but after that, I am not sure what to do. Does…

Amanda Johansson
- 15
- 2
1
vote
2 answers
How to pass list of values to user defined function (UDF) in Excel
---------------------------------------
A B C D
---------------------------------------
Timestamp Stock Qty Price
---------------------------------------
01 February 2011 ST1 100 10
02 March 2013 …

Ishwar Jindal
- 373
- 1
- 2
- 10