Search code examples
if-statementgoogle-sheetstransposearray-formulasgoogle-sheets-query

How can I acheive this transformation in google sheets?


enter image description here

I want the rows on the left to be transformed into the one on the right (by splitting on a comma) , Actual data contains thousand of such rows, how can I do it easily?


Solution

  • use:

    ={A1:D1; ARRAYFORMULA(SPLIT(QUERY(FLATTEN(IF(IFERROR(SPLIT(C2:C, ","))="",,
     A2:A&"♀"&B2:B&"♀"&SPLIT(C2:C, ",")&"♀"&D2:D)), 
     "where Col1 is not null"), "♀"))}
    

    0