Concatenate non empty cells in each row with arrayformula in google sheets

Viewed 49

I have a range of values and empty cells A2:F15 I whant to concatinate only non empty cells usign a single formula Arrayformula, Make a copy of this example sheet.

I created this formula but it's not an array based

=TEXTJOIN(", ",,TRANSPOSE(QUERY(FLATTEN(A2:F2)," where Col1 is not null ")))

enter image description here

1 Answers

use query smash:

=INDEX(REGEXREPLACE(TRIM(FLATTEN(QUERY(TRANSPOSE(IF(A2:F="",,A2:F&",")),,9^9))), ",$", ))
Related