Previously I had similar problem with this one, where I needed to assign a value to array's element then use ARRAYTOTEXT function.
The reason I use arraytotext function is because I need to do iteration involving dynamic array variables, so I store the arrays in some cells in a row for each iteration and iterate downward.
So this time I made custom function: InsertArray=LAMBDA(array,i,val,LET(ib,SEQUENCE(ROWS(array)+1),IF(ib<i,INDEX(array,ib),IF(ib>i,INDEX(array,ib-1),val))))
The custom function works, but the output is again incompatible with arraytotext function where it gives me incorrect result for following case:
A={1;2}
B=InsertArray(A,3,3)={1;2;3}
C=ARRAYTOTEXT(InsertArray(A,3,3),1)='{1;1;3}' < It should be '{1;2;3}' >
Previously, I had to remove VSTACK in custom function and it works, this time I don't know what else can I try to make it work?
The reason I use arraytotext function is because I need to do iteration involving dynamic array variables, so I store the arrays in some cells in a row for each iteration and iterate downward.
So this time I made custom function: InsertArray=LAMBDA(array,i,val,LET(ib,SEQUENCE(ROWS(array)+1),IF(ib<i,INDEX(array,ib),IF(ib>i,INDEX(array,ib-1),val))))
The custom function works, but the output is again incompatible with arraytotext function where it gives me incorrect result for following case:
A={1;2}
B=InsertArray(A,3,3)={1;2;3}
C=ARRAYTOTEXT(InsertArray(A,3,3),1)='{1;1;3}' < It should be '{1;2;3}' >
Previously, I had to remove VSTACK in custom function and it works, this time I don't know what else can I try to make it work?