By: Robert Thompson

Or you can do it in a formula. It works better if you convert your original columns (Colors and Sizes) to Excel tables. But the below also works with Named Ranges or original ranges (e.g., B5:B9).

=LET(LenX, ROWS(Colors),
LenY, ROWS(Sizes),
Seq, SEQUENCE(LenX*LenY,,0),
Array1, XLOOKUP(INT((Seq)/LenY)+1, SEQUENCE(LenX), Letters, “”),
Array2, XLOOKUP(MOD(Seq,LenY), SEQUENCE(LenY,,0), Numbers, “”),
HSTACK(Array1, Array2))

This can then be used to define a Lambda function named “CrossJoin”:
=LAMBDA(Table1,Table2,
LET(LenX,ROWS(Table1),
LenY,ROWS(Table2),
Seq,SEQUENCE(LenX*LenY,,0),
Array1,XLOOKUP(INT((Seq)/LenY)+1,SEQUENCE(LenX),Table1,””),
Array2,XLOOKUP(MOD(Seq,LenY),SEQUENCE(LenY,,0),Table2,””),
HSTACK(Array1, Array2)))

Now you can simply call:
=CrossJoin(Colors, Sizes)