See the formulas in H12:J23 in the attached Excel file.
The XIRR formula in I13 that corresponds to your calculation in I9 is:
=XIRR(IF(ROW($A$2:$A$35)=ROW($A$2), INDEX($C$2:$C$34,MATCH($H13,$A$2:$A$34,0)),
IF(ROW($A$2:$A$35)=ROW($A$35), INDEX($E$2:$E$34,MATCH($H13,$A$2:$A$34,0)),
IF(ROW($A$2:$A$35)=ROW($A$2)+MATCH($H13,$A$2:$A$34,0)-1, 0,
IF($A$2:$A$35=$H13, $C$2:$C$35, 0)))),
IF(ROW($A$2:$A$35)=ROW($A$2), INDEX($B$2:$B$34,MATCH($H13,$A$2:$A$34,0)),
IF(ROW($A$2:$A$35)=ROW($A$35), INDEX($D$2:$D$34,MATCH($H13,$A$2:$A$34,0)),
IF($A$2:$A$35=$H13, $B$2:$B$35, 0))))
The XIRR formula in J13 that corresponds to your calculation in I10 is:
=XIRR(IF(ROW($A$2:$A$36)=ROW($A$2), INDEX($C$2:$C$34,MATCH($H13,$A$2:$A$34,0)),
IF(ROW($A$2:$A$36)=ROW($A$35), INDEX($E$2:$E$34,MATCH($H13,$A$2:$A$34,0)),
IF(ROW($A$2:$A$36)=ROW($A$36), $J$6,
IF(ROW($A$2:$A$36)=ROW($A$2)+MATCH($H13,$A$2:$A$34,0)-1, 0,
IF($A$2:$A$36=$H13, $C$2:$C$36, 0))))),
IF(ROW($A$2:$A$36)=ROW($A$2), INDEX($B$2:$B$34,MATCH($H13,$A$2:$A$34,0)),
IF(ROW($A$2:$A$36)=ROW($A$35), INDEX($D$2:$D$34,MATCH($H13,$A$2:$A$34,0)),
IF(ROW($A$2:$A$36)=ROW($A$36), $I$6,
IF($A$2:$A$36=$H13, $B$2:$B$36, 0)))))
Note that the ranges 2:35 and 2:36 purposely reference 1 and 2 rows, respectively, below the table of cash flows (2:34). In contrast, the range 2:34 is sufficient for the INDEX/MATCH.
The formulas must be array-entered (press ctrl+shift+Enter) in Excel 2010 and some other versions of Excel.
They can be simplified in Office Excel 365 and perhaps some later versions of Excel by using a LET function to calculate the MATCH index only once.
(Further simplification might be possible by using new functions in recent versions of Excel. I am not familiar with them.)
As "proof of concept", compare with the formulas in N1:AI39.
Note: In order to use the Excel file in your posting #1, I replaced the circular-reference formulas in column E with constants.
Bookmarks