ACLMJOIN

=ACLMJOIN(a,cm,cx,ec,ni,d)

a
array
cm
integer, min column index, 0 or ignored will take 1 value
cm
integer, max column index, 0 or ignored will take value columns(a)
ni
integer, after this new column index of the remaining array, the extracted joined array will be inserted, 1<=ni< columns(remaining array) or special values: -1,appends extr.array to the left of remaining array, 0 or ignored, to the right

textjoins chosen pattern of columns indexes of an array, by a delimiter "d", and inserts the result after the "ni" new column index of remaining array

Xlambda

Well-known Member
Joined
Mar 8, 2021
Messages
860
Office Version
  1. 365
Platform
  1. Windows
ACLMJOIN array columns join, textjoins chosen pattern of columns indexes of an array, by a delimiter "d", and inserts the result after the "ni" new column index of remaining array . Calls ASELECT , ATEXTJOIN , ABINSERT
a: array; cm, column min ; cx, column max ; ec, extra columns ; ni, new column index ; d, delimiter
Example: imagine 10clms array. column pattern: cm=4,cx=7, ec={2,9} , ni=2 .
The formula extracts all columns btwn cm(min) and cx(max) and adds the extra columns, everything in ascending order from left to right. The extracted array will contain this sequence of columns {2,4,5,6,7,9}. The remaining array after extraction, will contain columns {1,3,8,10} . The formula ATEXTJOINs the extracted array in a single column and inserts it after 2nd new column index of remaining array (ni=2) so, between 3 and 8. The result array will look like this {1,3, extr.array joined , 8,10} or {1,3,(2,4,5,7,9),8,10}
The algorithm for column pattern is the same like in ASELECT, so if by mistake you introduce cm>cx, formula knows to put them in order, or values out of columns range will be ignored.
ni argument has the same behavior like ci argument of ABINSERT : -1, extracted textjoined array will be appended to the left of remaining array, 0 or ignored, to the right , or ni should be in this interval 1<=ni<columns(remaining array) . Out of this values, returns error mes. "check data", the message caried by ABINSERT functionality.
Excel Formula:
=LAMBDA(a,cm,cx,ec,ni,d,
    LET(c,COLUMNS(a),s,SEQUENCE(,c),as,ASELECT(a,,,cm,cx,ec),y,ATEXTJOIN(as,,,d),ss,ASELECT(s,,,cm,cx,ec),
       x,FILTER(a,ISNA(XMATCH(s,ss))),
       ABINSERT(x,y,ni)
    )
)
LAMBDA 8.0.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJ
1sample arrayJoin all numeric columns to the right of letters arrayJoin all letter columns to the left of numbers arrayJoin all letters columns after second column of numeric array
2=ACLMJOIN(A3:J7,6,8,{2,10},,",")=ACLMJOIN(A3:J7,3,5,{1,9},-1,"/")=ACLMJOIN(A3:J7,3,5,{1,9},2,"/")
3A1FKP61116AB21AFKPAB1,6,11,16,21A/F/K/P/AB1611162116A/F/K/P/AB111621
4B2GLQ71217CD22BGLQCD2,7,12,17,22B/G/L/Q/CD2712172227B/G/L/Q/CD121722
5C3HMR81318EF23CHMREF3,8,13,18,23C/H/M/R/EF3813182338C/H/M/R/EF131823
6D4INS91419GH24DINSGH4,9,14,19,24D/I/N/S/GH4914192449D/I/N/S/GH141924
7E5JOT101520IJ25EJOTIJ5,10,15,20,25E/J/O/T/IJ510152025510E/J/O/T/IJ152025
8
9
10if wrong values introduced
11=ACLMJOIN(A3:J7,5,3,{1,11},2,"/")
1216A/F/K/P1116AB21
1327B/G/L/Q1217CD22
1438C/H/M/R1318EF23
1549D/I/N/S1419GH24
16510E/J/O/T1520IJ25
17wrong arguments handling
18if cm(min)>cx(max) (5>3) , no problem formula put them in order
19ec={1,11} value 11 in extra column argument is ignored (array has only 10 columns), formula considers only ec={1}
20
ACLMJOIN post
Cell Formulas
RangeFormula
L2,Z11,Z2,S2L2=FORMULATEXT(L3)
L3:Q7L3=ACLMJOIN(A3:J7,6,8,{2,10},,",")
S3:X7S3=ACLMJOIN(A3:J7,3,5,{1,9},-1,"/")
Z3:AE7Z3=ACLMJOIN(A3:J7,3,5,{1,9},2,"/")
Z12:AF16Z12=ACLMJOIN(A3:J7,5,3,{1,11},2,"/")
Dynamic array formulas.
 
Upvote 0
Task: Create single cell formula that generates a random array, 20 rows , with elements of array A, taking in consideration product's cost/selling prices as in array B
Functions on minisheet : AMERGE , ARANDOM , ACLMJOIN , ACLMSPLIT
Note: 2 ways, step by step or one step. The final results of these 2 methods will be different because of AROUND embedded in one step formula that will randomize other values, ofcourse.
LAMBDA 8.0.xlsx
ABCDEFGHIJKLMNOPQRST
1Task: Create single cell formula that generates a random array, 20 rows , with elements of array A, taking in consideration product's cost/selling prices as in array B
2
3Step 1 - merging AB (left outer)Step 3 - create random arrayStep 4 - split 2nd column
4array A=AMERGE(A5:C11,A14:C17,2,1)=ARANDOM(E15#,20)=ACLMSPLIT(K5#,2,"-")
5Theodore KrigerProd AWestTheodore KrigerProd AWest811Antione ScheidlerProd B-6-9NorthAntione ScheidlerProd B69North
6Antione ScheidlerProd BEastAntione ScheidlerProd BEast69Rey McglothlinProd D-7-10WestRey McglothlinProd D710West
7Freddie OttenProd CNorthFreddie OttenProd CNorth58Rey McglothlinProd C-5-8NorthRey McglothlinProd C58North
8Mel ScheidlerProd DWestMel ScheidlerProd DWest710Rey McglothlinProd D-7-10NorthRey McglothlinProd D710North
9Jesus PasquarielloJesus PasquarielloHouston YbarboProd C-5-8NorthHouston YbarboProd C58North
10Houston YbarboHouston YbarboAntione ScheidlerProd B-6-9WestAntione ScheidlerProd B69West
11Rey McglothlinRey McglothlinHouston YbarboProd A-8-11EastHouston YbarboProd A811East
12Houston YbarboProd C-5-8EastHouston YbarboProd C58East
13array Bcostsl.priceStep 2 - join columns 2,4,5Theodore KrigerProd A-8-11EastTheodore KrigerProd A811East
14Prod D710=ACLMJOIN(E5#,4,,{2},1,"-")Houston YbarboProd B-6-9WestHouston YbarboProd B69West
15Prod B69Theodore KrigerProd A-8-11WestHouston YbarboProd D-7-10EastHouston YbarboProd D710East
16Prod A811Antione ScheidlerProd B-6-9EastHouston YbarboProd B-6-9EastHouston YbarboProd B69East
17Prod C58Freddie OttenProd C-5-8NorthHouston YbarboProd A-8-11WestHouston YbarboProd A811West
18Mel ScheidlerProd D-7-10WestFreddie OttenProd B-6-9NorthFreddie OttenProd B69North
19Jesus PasquarielloTheodore KrigerProd D-7-10EastTheodore KrigerProd D710East
20Houston YbarboAntione ScheidlerProd B-6-9WestAntione ScheidlerProd B69West
21Rey McglothlinHouston YbarboProd B-6-9EastHouston YbarboProd B69East
22Mel ScheidlerProd A-8-11WestMel ScheidlerProd A811West
23Freddie OttenProd A-8-11WestFreddie OttenProd A811West
24formulasMel ScheidlerProd C-5-8WestMel ScheidlerProd C58West
25AMERGE
26ACLMJOINOne Step - single cell formula
27ARANDOM=ACLMSPLIT(ARANDOM(ACLMJOIN(AMERGE(A5:C11,A14:C17,2,1),4,,{2},1,"-"),20),2,"-")
28ACLMSPLIT
29Theodore KrigerProd D710North
30Freddie OttenProd D710East
31Rey McglothlinProd D710West
32Jesus PasquarielloProd C58West
33Rey McglothlinProd B69West
34Jesus PasquarielloProd A811West
35Houston YbarboProd B69West
36Jesus PasquarielloProd A811North
37Freddie OttenProd A811West
38Jesus PasquarielloProd D710West
39Antione ScheidlerProd B69West
40Antione ScheidlerProd D710North
41Antione ScheidlerProd A811East
42Antione ScheidlerProd A811East
43Freddie OttenProd A811East
44Antione ScheidlerProd A811West
45Jesus PasquarielloProd D710North
46Antione ScheidlerProd B69West
47Rey McglothlinProd B69North
48Antione ScheidlerProd A811North
49
50Need this more often with difrent arrays, just write a LET or LAMBDA with 3 variables, arrayA,arrayB,nr rows
51
ACLMJOIN x2
Cell Formulas
RangeFormula
E4,E14,O4,K4E4=FORMULATEXT(E5)
E5:I11E5=AMERGE(A5:C11,A14:C17,2,1)
K5:M24K5=ARANDOM(E15#,20)
O5:S24O5=ACLMSPLIT(K5#,2,"-")
E15:G21E15=ACLMJOIN(E5#,4,,{2},1,"-")
I27I27=FORMULATEXT(K29)
K29:O48K29=ACLMSPLIT(ARANDOM(ACLMJOIN(AMERGE(A5:C11,A14:C17,2,1),4,,{2},1,"-"),20),2,"-")
Dynamic array formulas.
 

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