I have recently created a LAMBDA
function for recursive substitutions of substrings which works when using a range:
LAMBDA
named ReplaceArray
=LAMBDA(str, list, sub, IF(ROWS(list)=1, SUBSTITUTE(str,list,sub), ReplaceArray(SUBSTITUTE(str,INDEX(list,1),sub),OFFSET(list,1,0,ROWS(list)-1),"")))
So for example with a range of cells:
A | |
---|---|
1 | ABBAAABACDBDADCD |
2 | AA |
3 | AB |
4 | AC |
5 | AD |
=ReplaceArray(A1,A2:A5,"")
Gives cell value "BDBDCD"
However, when I try and use an array of values, I instead generate a SPILL
range where in this case I have four values where each of the hard-coded values have been replaced in turn.
=ReplaceArray(A1,{"AA","AB","AC","AD"},"")
Interesting, but not what I am after.
I have tried using TRANSPOSE
on the list to no avail.
Does anyone know how would I go about being able to use a hardcoded set of strings?