An interative Recursive Array formula (excel only)

Spyros13

Board Regular
Joined
Mar 12, 2014
Messages
175
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have [370, 380, 281, 484, …] in Cell C4.

I want to add 2 to each number separated by the columns, and do so without using VBA or Python ,

So, in D4 I can do Rick Rothenstiens array formula ,
Code:
={SUBSTITUTE(SUBSTITUTE(TRIM(MID(SUBSTITUTE($C$3,",",REPT(" ",999)),COLUMNS($A:A)*999-998,999)),"[",""),",","")+2}
& it extracts each number out when i enter as Array I can drag across.

And that gives 372, 382, 283, 485, .. etc etc, in different cells accross the adjacent range of columns. Then I can concatenate the ranges using TextJoin (but I don't have MS O 360), so I used any number of the available concatenate cells UDF's I have. Great.

No. That still leaves me with messy helper columns either in the main sheet in working in, or in sheet2.

I would like an array formula which does the work to the 'cell' (sorry, should call it array element or extracted string/number) of adding 2 in this case, all outputted in D4. So D4 looks like this:

[372, 382, 283, 485, ...] straight away after CSE.

p.s. The numbers seperated by delimanator (commas in this case) are NOT always 3 digits in length (can be 5 or 6 or 9 too)

the closest NON-VBA way I have got to this is very cave-man like and combersome (although If i have enough for each delimanation in column C, I can just simply drag down), but its messy imo and un-pythonic/un-excelly if you excuse the phrase.

Yep, what I did, so far is :

Code:
=SUBSTITUTE(SUBSTITUTE(TRIM(MID(SUBSTITUTE($C$3,",",REPT(" ",999)),COLUMNS($A:A)*999-998,999)),"[",""),",","")+2&", "&SUBSTITUTE(SUBSTITUTE(TRIM(MID(SUBSTITUTE($C$3,",",REPT(" ",999)),COLUMNS($A:B)*999-998,999)),"[",""),",","")+2&", "&SUBSTITUTE(SUBSTITUTE(TRIM(MID(SUBSTITUTE($C$3,",",REPT(" ",999)),COLUMNS($A:C)*999-998,999)),"[",""),",","")+2&" , "&SUBSTITUTE(SUBSTITUTE(TRIM(MID(SUBSTITUTE($C$3,",",REPT(" ",999)),COLUMNS($A:D)*999-998,999)),"[",""),",","")+2

I should be embarassed. But Im not. I am asking for help.

I tried using
Code:
CHOOSE(COLUMNS($A:C),1,2,3)*999-998,999)
, got something of an inkling of how it could work ,in the highlighted red bit, to mimick an iteration through all those columns it would have to go through if it was a traditional array, so it does them all at once in once cell, but my know-how wasn't good enough. But implementing choose might be the way to go.

Going to bed, If anyone cal help if be grateful.

Anyone know?/Can help?
 
Last edited:
Rick, You have helped me immensely & I appreciate it ! I've already done something with your udf , and shall be doing more, and will be using it a lot more going forward. So Thank you ! Grateful! Grateful Thank you !
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,214,982
Messages
6,122,575
Members
449,089
Latest member
Motoracer88

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