ABINSERT

=ABINSERT(a,b,ci)

a
array
b
array
ci
integer; 1<=ci<columns(a) or special values: -1 appends ba, 0 or ignored appends ab

inserts array "b" to the right of column index "ci" of array "a"

Xlambda

Well-known Member
Joined
Mar 8, 2021
Messages
860
Office Version
  1. 365
Platform
  1. Windows
ABINSERT inserts array "b" to the right of column index "ci" of array "a" . Calls APPEND2H
ci: column index argument, should be in interval 1<=ci<columns(a), special values: -1,appends array "b" to the left of "a", 0 or ignored, appends array "b" to the right of "a" .
Note: any other values out of the interval or other than special values -1,0 , returns an error mes. "check data". If ci=columns(a) still error mes. (insert after last column is not inserting, is appending, so we have to use ci=0 for that scenario)
The (ci+1)'s column of result array will be the 1st column of "b" array
Excel Formula:
=LAMBDA(a,b,ci,
    SWITCH(ci,0,APPEND2H(a,b,),-1,APPEND2H(b,a,),LET(c,COLUMNS(a),s,SEQUENCE(,c),x,FILTER(a,s<=ci),y,FILTER(a,s>ci),IFERROR(APPEND2H(APPEND2H(x,b,),y,),"check data"))
    )
)
LAMBDA 8.0.xlsx
ABCDEFGHIJKLMNOPQ
1array Aarray B
2=SEQUENCE(5,5)=ABINSERT(A3#,G3:H5,3)
312345ax123ax45
4678910by678by910
51112131415cz111213cz1415
616171819201617181920
721222324252122232425
8
9ci column index=ABINSERT(A3#,G3:H5,)
10-1 appends array b to the left of array a12345ax
110 or ignored,appends b to the right of a678910by
121<=ci<columns(a) ( column [ci+1] of result array1112131415cz
13will be first column of b array )1617181920
14(values out of above interval triggers2122232425
15error message "check data")
16=ABINSERT(A3#,G3:H5,-1)
17=ABINSERT(A3#,G3:H5,5)ax12345
18check databy678910
19(ci should be < columns(a)cz1112131415
20if we want b to the right of a ci=0,or ignored)1617181920
212122232425
22=ABINSERT(A3#,G3:H5,10)
23check data=ABINSERT(A3#,G3:H5,1)
241ax2345
25=ABINSERT(A3#,G3:H5,-2)6by78910
26check data11cz12131415
271617181920
282122232425
29
ABINSERT post
Cell Formulas
RangeFormula
A2,A25,J23,A22,A17,J16,J9,J2A2=FORMULATEXT(A3)
A3:E7A3=SEQUENCE(5,5)
J3:P7J3=ABINSERT(A3#,G3:H5,3)
J10:P14J10=ABINSERT(A3#,G3:H5,)
J17:P21J17=ABINSERT(A3#,G3:H5,-1)
A18A18=ABINSERT(A3#,G3:H5,5)
A23A23=ABINSERT(A3#,G3:H5,10)
J24:P28J24=ABINSERT(A3#,G3:H5,1)
A26A26=ABINSERT(A3#,G3:H5,-2)
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,223,604
Messages
6,173,319
Members
452,510
Latest member
RCan29

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