XIRR with dynamic range

kylc3

New Member
Joined
Jun 16, 2017
Messages
14
Hi,

I work in the investment industry and am trying to calculate the XIRR of our various mutual funds using the dates and the monthly withdrawal amounts that change over time, with the ending amount being the last number from the post-withdrawal column. The issue is that I have to manually adjust the range to fit exactly, or else the formula errors. Is there a way to use an XIRR formula that is flexible enough to accommodate the different time periods without having to manually adjust the range to perfectly fit the number or rows?
 
Last edited by a moderator:

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
A concrete example would. In addition to dynamic cell references, you might also need to fudge the sign of values (plus or minus), depending on the "sign" convention that you chose.
 
Upvote 0
I think you want something the following.

I
J
K
L
M
N
1
Date
End Bal
Cash Flow
XIRR
2
12/31/2015
500,000
500,000
3
1/31/2016
488,506
-2,083
-23.95%
4
2/29/2016
486,222
-2,083
-13.44%
5
3/31/2016
509,483
-2,083
11.46%
6
4/30/2016
512,765
-2,083
11.99%
7
5/31/2016
512,369
-2,083
10.32%
8
6/30/2016
519,898
-2,083
12.66%
9
7/31/2016
527,801
-2,083
14.39%
10
8/31/2016
523,195
-2,083
11.68%
11
9/30/2016
522,390
-2,083
10.72%
12
10/31/2016
511,980
-2,083
7.54%
13
11/30/2016
511,427
-2,083
7.20%
14
12/31/2016
517,931
-2,083
8.33%
15
1/31/2017
523,101
-2,146
9.03%
16
2/28/2017
531,993
-2,146
10.35%
17
3/31/2017
532,828
-2,146
10.11%
18
4/30/2017
534,237
-2,146
10.01%
19
5/31/2017
541,631
-2,146
10.74%
20
6/30/2017
539,563
-2,146
10.15%
21
7/31/2017
545,991
-2,146
10.67%
22
8/31/2017
545,057
-2,146
10.26%

<tbody>
</tbody>

Rich (BB code):
Formula:
N3: { =XIRR(IF(ROW($M$2:M3)=ROW(M3), -L3, $M$2:M3), $I$2:I3) }
Copy N3 into N4:N22

Formulas displayed with curly brackets {...} are array-entered. Type the formulas without the curly brackets, then press ctrl+shift+Enter instead of just Enter. Excel displays the curly brackets in the Formula Bar to indicate that the formula is array-entered.

Your XIRRs might differ because I am using the rounded amounts in the image, not the calculated amounts.
 
Last edited:
Upvote 0
Thank you! I'll give it a shot.

This seemed to work as well... =xirr(m2:index(m2:m150,match("",i2:i150,)-1),i2:index(i2:i150,match("",i2:i50,)-1))
 
Upvote 0
This seemed to work as well...
=xirr(m2:index(m2:m150,match("",i2:i150,)-1),i2:index(i2:i150,match("",i2:i50,)-1))

Oh, I misunderstood your requirements.

Ostensibly, your formula calculates one IRR based on all the cash flows to-date, allowing you to add new cash flows and automatically calculate the updated IRR.

However, match("",i2:i150,) results in a #N/A error. I would write MATCH(1E300,I2:I150). 1E300 is some large number greater than any date.

But the modified formula:

=XIRR(M2:INDEX(M2:M150,MATCH(1E+300,I2:I150)), I2:INDEX(I2:I150,MATCH(1E+300,I2:I50)))

results in the wrong IRR. For the example posted (rows 2:22), the formula results in about -89.17%, whereas the correct IRR is about 10.26%, as demonstrated in my response #4 .

That reason is: the formula fails to substitute the negative ending balance for the last cash flow.

Instead, use the following
array-entered formula (press ctrl+shift+Enter instead of just Enter):

Code:
=XIRR(IF(ROW(M2:INDEX(M2:M150,O2))=ROW(INDEX(M2:M150,O2)), -INDEX(L2:L150,O2), M2:INDEX(M2:M150,O2)), I2:INDEX(I2:I150,O2))

where O2 contains the formula =MATCH(1E+300,I2:I150). Of course, you might choose to replace O2 in the formula above with the MATCH formula.
 
Upvote 0
Errata....
However, match("",i2:i150,) results in a #N/A error.


Oh! You might have populated unused cells in I2:I150 with the null string (""). In that case, there is no #N/A error. I had left unused cells empty.

Neverthess, the formula:

=XIRR(M2:INDEX(M2:M150, MATCH("", I2:I150,)-1), I2:INDEX(I2:I150, MATCH("",I2:I50,)-1))

results in the wrong IRR, namely about -89.17%, whereas the correct IRR is about 10.26% through I2.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,716
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top