Join two Arrays???

rcreek09

New Member
Joined
Dec 18, 2009
Messages
28
Office Version
  1. 365
Platform
  1. Windows
Trying to pair EACH element of A1:A4 with EACH element of B1:B4 to create a new data set of all combinations. Desired results in D1:E16.
1683578383942.png


Seems like a good candidate for LAMBDA, BYROW, and/or maybe MAP but just can't seem to get there! Even tried PERMUT but no luck.
Am I overcomplicating it or is it just not doable??? Prefer to not use VBA.
Would need to allow for different "sizes" between the two arrays as well.
Using Windows 10, Excel 365.
Thanks!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try:

Book1
ABCDE
1dog5dog5
2cat3dog3
3bird2dog2
4car4dog4
57dog7
6cat5
7cat3
8cat2
9cat4
10cat7
11bird5
12bird3
13bird2
14bird4
15bird7
16car5
17car3
18car2
19car4
20car7
21
Sheet3
Cell Formulas
RangeFormula
D1:E20D1=LET(a,COUNTA(A:A),b,COUNTA(B:B),s,SEQUENCE(a*b,,0),CHOOSE({1,2},INDEX(A1:A10,INT(s/b)+1),INDEX(B1:B10,MOD(s,b)+1)))
Dynamic array formulas.
 
Upvote 1
I hesitate to post my first thought.
Try Vstack
Convert to value and then sort or custom sort

LAMBDA.xlsm
ABCGHIJK
1dog5dog5dog5
2cat3cat3dog7
3bird2bird2dog4
4car4car4dog2
57dog7dog3
6cat5cat3
7bird3cat5
8car2cat7
9dog4cat4
10cat7cat2
11bird5car4
12car3car2
13dog2car3
14cat4car5
15bird7car7
16car5bird2
17dog3bird3
18cat2bird5
19bird4bird7
20car7bird4
21
8c
Cell Formulas
RangeFormula
G1:G20G1=VSTACK(r_1,r_1,r_1,r_1,r_1)
H1:H20H1=VSTACK(R_2,R_2,R_2,R_2)
Dynamic array formulas.
Named Ranges
NameRefers ToCells
r_1='8c'!$A$1:$A$4G1
R_2='8c'!$B$1:$B$5H1
 
Upvote 0
Another option
Fluff.xlsm
ABCDE
1dog5dog5
2cat3dog3
3bird2dog2
4car4dog4
57dog7
6cat5
7cat3
8cat2
9cat4
10cat7
11bird5
12bird3
13bird2
14bird4
15bird7
16car5
17car3
18car2
19car4
20car7
21
Sheet4
Cell Formulas
RangeFormula
D1:E20D1=HSTACK(TOCOL(IF(SEQUENCE(,COUNTA(B1:B100)),FILTER(A1:A100,A1:A100<>""))),TOCOL(IF(SEQUENCE(,COUNTA(A1:A100)),FILTER(B1:B100,B1:B100<>"")),,1))
Dynamic array formulas.
 
Upvote 0
Solution
All good solutions I'm sure; thanks to all.
Fluff's solution is my preference; I tried it and it works perfectly!

Very thankful to have such wisdom available at my fingertips, and for free!
Rock on!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Another possible option

23 05 09.xlsm
ABCDE
1dog5dog5
2cat3dog3
3bird2dog2
4car4dog4
57dog7
6cat5
7cat3
8cat2
9cat4
10cat7
11bird5
12bird3
13bird2
14bird4
15bird7
16car5
17car3
18car2
19car4
20car7
Combine
Cell Formulas
RangeFormula
D1:E20D1=LET(b,ROWS(B1:B5),r,b*ROWS(A1:A4),HSTACK(INDEX(A1:A4,SEQUENCE(r,,,1/b)),INDEX(B1:B5,MOD(SEQUENCE(r,,0),b)+1)))
Dynamic array formulas.


.. or if your two ranges are both the same size as in your sample it shortens marginally

23 05 09.xlsm
ABCDE
1dog5dog5
2cat3dog3
3bird2dog2
4car4dog4
5cat5
6cat3
7cat2
8cat4
9bird5
10bird3
11bird2
12bird4
13car5
14car3
15car2
16car4
Combine (2)
Cell Formulas
RangeFormula
D1:E16D1=LET(d,A1:B4,b,ROWS(d),r,b^2,HSTACK(INDEX(d,SEQUENCE(r,,,1/b),1),INDEX(d,MOD(SEQUENCE(r,,0),b)+1,2)))
Dynamic array formulas.
 
Upvote 0

Forum statistics

Threads
1,215,378
Messages
6,124,603
Members
449,174
Latest member
ExcelfromGermany

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