Search code examples
sqlgoogle-sheets

Normalize Google Sheet table (1st step)


I want to convert following table in Google Sheet:

Process Tool A Tool B
Process 1 Tool 1 Tool 2
Process 2 Tool 1
Process 3 Tool 2 Tool 3

into following table:

Process Tool A Tool B
Process 1 Tool 1
Process 1 Tool 2
Process 2 Tool 1
Process 3 Tool 2
Process 3 Tool 3

I understand that there are various options (Google Sheets QUERY() function, etc), but I am unfortunately stuck. I will highly appreciate any advise on this issue.


Solution

  • You may try:

    =reduce(A1:B1,B2:C,lambda(a,c,vstack(a,if(c="",tocol(,1),{index(A:A,row(c)),c}))))
    

    enter image description here