Search code examples
google-sheetsgoogle-sheets-formula

Combining multiple rows and columns in one cell (merged cell) without losing the text new line


As per the subject, does anyone know how to combine rows of text and automatically get a new line when another row is added? Here's an example:

INPUT TABLE:

+ A B C
1 ORDER ID Original Currency To USD
2 123ABC SAR 123.00 $33.21
3 456DEF SAR 43.00 $11.61
4 246HIJ SAR 54.00 $14.58

OUTPUT (to be in a single merged cell):

+ F
1 RESULT/OUTPUT
2 123ABC - SAR 123.00 - $33.21
456DEF - SAR 43.00 - $11.61
246HIJ - SAR 54.00 - $14.58

Solution

  • You may try:

    =join(char(10),filter(A2:A&" - "&switch(to_text(B2:B),"",0,to_text(B2:B))&" - "&switch(to_text(C2:C),"",0,to_text(C2:C)),byrow(A2:C,lambda(Σ,counta(Σ)=3))))
    

    enter image description here