Search code examples
google-sheetsgoogle-sheets-formula

Google Sheet - Complex formula to align cartesian product in one column


Apologies about the title, I'm not sure how to formulate this.

I have this simple set of data in a google sheet:

  • Original
  • Version 1
  • Version 2

I'd like to have a pair of each combination, separated by a blank cell each time (and all in one column).
If there is 4 or more rows in column A, the formula should adapt to it as well.

It's going to be way easier to understand with the sample spreadsheet below:

https://docs.google.com/spreadsheets/d/1hM_NObirWaY1G9bCbZ1HMPuV9p4WX6pmBIO9ccx1gHo/edit#gid=0

Thanks in advance for the help.


Solution

  • Another solution:

    =ARRAYFORMULA(LET(v,TOCOL(B3:B,1),i,SEQUENCE(ROWS(v)),TOCOL(SPLIT(
       TOCOL(HSTACK(TOCOL(IF(i>=TOROW(i),,v&"❅"&TOROW(v)),1),)),"❅"),2)))
    

    enter image description here