XIRR with non-contiguous last value

spreadsheetmaker

New Member
Joined
Nov 2, 2018
Messages
5
I have been wrestling with a XIRR formula for the past week. I have a table with outflows and fund names for each outflow. I created a XIRR formula that not only takes into a count a specific fund identified in cell F2 but also prevents any XIRR errors when the initial outflow value is 0. The issue that I'm having right now is that my present value of the fund is located in a non-contiguous cell (G6). I need to somehow expand the array that XIRR is calculating to include the last value in cell G6 with today's date. Based on the data provided, the expected XIRR should be 3.41%.


DateFUND XIRR VALUE FUNDXIRR:
1/1/2015A $ - D#N/A
1/1/2015B $ -
1/1/2015C $ -
1/1/2015D $ - Todays: Fund Value
1/1/2015E $ - D $ 119,000.00
1/1/2015F $ -
1/1/2015G $ -
1/1/2015D $ -
11/17/2014A $ (75,000.00)
1/8/2015B $ (35,000.00)
10/14/2014C $ (75,000.00)
1/8/2015D $ (35,000.00)
1/14/2015D $ (50,000.00)
1/14/2015B $ (50,000.00)
6/8/2015D $ (20,000.00)

<colgroup><col><col><col span="2"><col span="2"><col></colgroup><tbody>
</tbody>


Current formula in cell G2 is: =XIRR(IF(OFFSET($B$1:$B$16,MATCH(1, ($B$1:$B$16 = F2) * ($C$1:$C$16 <> 0),0)-1,0,ROWS($B$1:$B$16)-MATCH(1, ($B$1:$B$16 = F2) * ($C$1:$C$16 <> 0),0)+1,1)=F2,OFFSET($C$1:$C$16,MATCH(1, ($B$1:$B$16 = F2) * ($C$1:$C$16 <> 0),0)-1,0,ROWS($B$1:$B$16)-MATCH(1, ($B$1:$B$16 = F2) * ($C$1:$C$16 <> 0),0)+1,1),0),IF(OFFSET($B$1:$B$16,MATCH(1, ($B$1:$B$16 = F2) * ($C$1:$C$16 <> 0),0)-1,0,ROWS($B$1:$B$16)-MATCH(1, ($B$1:$B$16 = F2) * ($C$1:$C$16 <> 0),0)+1,1)=F2,OFFSET($A$1:$A$16,MATCH(1, ($B$1:$B$16 = F2) * ($C$1:$C$16 <> 0),0)-1,0,ROWS($B$1:$B$16)-MATCH(1, ($B$1:$B$16 = F2) * ($C$1:$C$16 <> 0),0)+1,1),0))


The reason why I can't simply add today's date to the bottom with the investment name and value is that the actual investment value is pulled from another worksheet. I linked the value of $119,000.00 to cell G6.

It doesn't look like I'm allowed to upload my spreadsheet right now as I'm a brand new forum member.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi,

If this is for Excel 2013 or later, array formula**:

=XIRR(IF(INDEX(1-MUNIT(1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")),,1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")),INDEX(C:C,N(IF(1,MODE.MULT(IF(B2:B16=F2,IF(C2:C16<>0,{1,1}*ROW(B2:B16))))))),G6),IF(INDEX(1-MUNIT(1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")),,1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")),INDEX(A:A,N(IF(1,MODE.MULT(IF(B2:B16=F2,IF(C2:C16<>0,{1,1}*ROW(B2:B16))))))),TODAY()))

If you're on a pre-2013 version I can amend accordingly.

Regards


**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
 
Upvote 0
Hey, I didn't realized that my home PC has Office 2010. Is there any way you could modify the formula to work on both 2010 and 2013? Thanks in advance!
 
Upvote 0
Ok, then use (still an array formula):

=XIRR(IF(N(ROW(INDEX(A:A,1):INDEX(A:A,1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")))<1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")),INDEX(C:C,N(IF(1,MODE.MULT(IF(B2:B16=F2,IF(C2:C16<>0,{1,1}*ROW(B2:B16))))))),G6),IF(N(ROW(INDEX(A:A,1):INDEX(A:A,1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")))<1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")),INDEX(A:A,N(IF(1,MODE.MULT(IF(B2:B16=F2,IF(C2:C16<>0,{1,1}*ROW(B2:B16))))))),TODAY()))

Regards
 
Upvote 0
Ok, then use (still an array formula):

=XIRR(IF(N(ROW(INDEX(A:A,1):INDEX(A:A,1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")))<1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")),INDEX(C:C,N(IF(1,MODE.MULT(IF(B2:B16=F2,IF(C2:C16<>0,{1,1}*ROW(B2:B16))))))),G6),IF(N(ROW(INDEX(A:A,1):INDEX(A:A,1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")))<1+COUNTIFS(B2:B16,F2,C2:C16,"<>0")),INDEX(A:A,N(IF(1,MODE.MULT(IF(B2:B16=F2,IF(C2:C16<>0,{1,1}*ROW(B2:B16))))))),TODAY()))

Regards

And once again you save the day!
 
Upvote 0

Forum statistics

Threads
1,214,545
Messages
6,120,132
Members
448,947
Latest member
test111

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