Stephen Gilmore

✖️ Cross join two lists in Google Sheets

Productivity February 22nd, 2023 1 minute read.

Today I learned how to do a "CROSS JOIN" or "cartesian product" between two columns in Google Sheets thanks to this stackoverflow question.

The answer: =INDEX(FLATTEN(A1:A3&"-"&TRANSPOSE(B1:B2)))

A B C
a 1 a-1
b 2 a-2
c b-1
b-2
c-1
c-1

From there, it's just a simple text to columns and depending on the data, maybe removing some duplicates.