Convert a comma separated string of values to an array of values for MIRR function

K Sandman

New Member
Joined
Nov 30, 2017
Messages
2
Greetings Excel Wizards,
Long-time (years) lurker here and am finally stumped with a question I can't find a solution for anywhere in the forum.

I am trying to utilize the MIRR() function with a dynamic number of periods without building a values table. For the 'values' argument in the function I want to be able to repeat the value in B2 for a specified number of years. My thought was to use the Rept() function, but it returns a string of comma separated values instead of an array of values. This results in a #Value ! error.

Here is the bugger I've been trying to make work: =MIRR((B1&REPT(","&B2,B4-1)&","&B3),B5,B6).

Seems like it should be simple enough, but I'm at a wall. Below is a demonstration table with all the inputs I'll be using in my workbook. I'll clarify that this formula will be filled-right for similar inputs in columns C,D,etc so it needs to be able to work with relative references.

Any help is much appreciated!

[TABLE="class: grid, width: 191"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Initial Investment[/TD]
[TD="align: right"]-10000[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD]Period Returns[/TD]
[TD="align: right"]1000[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD]Exit Period[/TD]
[TD="align: right"]9000[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD]# years[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD]Discount Rate[/TD]
[TD="align: right"]5.50%[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD]Reinvest Rate[/TD]
[TD="align: right"]5%[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD]MIRR[/TD]
[TD="align: center"]#Value ![/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi, welcome to the posting side of the forum :)

I don't know if it's the best way, but if I've understood correctly then here is one possible way.

See here for a description of the technique used to parse the comma separated list.

http://www.excelfox.com/forum/showthread.php/333-Get-Field-from-Delimited-Text-String


Excel 2013/2016
AB
1Initial Investment-10000
2Period Returns1000
3Exit Period9000
4# years5
5Discount Rate6%
6Reinvest Rate5%
7MIRR6%
Sheet1
Cell Formulas
RangeFormula
B7=MIRR(0+MID(SUBSTITUTE(B1&REPT(","&B2,B4-1)&","&B3,",",REPT(" ",99)),ROW(INDEX(B:B,1):INDEX(B:B,B4+1))*99-98,99),B5,B6)
 
Last edited:
Upvote 0
@FormR - I have verified that your solution works exactly as I had intended. Many thanks good sir! I have to say even after reading the explanation and slowly stepping through & evaluating the formula, it's going to take me a bit before I can implement that solution on my own. Here's to you.
 
Upvote 0
Hi, I thought about this a bit more and I think this is better (more robust & more efficient) . Pay attention to the array formulas note.


Excel 2013/2016
AB
1Initial Investment-10000
2Period Returns1000
3Exit Period9000
4# years5
5Discount Rate6%
6Reinvest Rate5%
7MIRR6.23%
Sheet1
Cell Formulas
RangeFormula
B7{=MIRR(CHOOSE(ROUNDUP((ROW(INDEX(B:B,1):INDEX(B:B,B4+1))-1)/(B4-1),0)+1,B1,B2,B3),B5,B6)}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,187
Members
452,616
Latest member
intern444

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