Combining a range of cells with a comma in google sheets

I would like to combine a range of data cells so that it comes out with only one text line and comma + space between them.

I managed to use concatenate

=ArrayFormula(concatenate(C3:F&", ")) 

but there are additional commas between some of the data, which do not have to be. And a lot of extra commas at the end.

Please see the example to better understand.

Example: https://docs.google.com/spreadsheets/d/1lHfyuR7r8xJmSPlUAa5bLAn7a7728KLNxmPl-UkYzTg/edit#gid=0

Any help would be greatly appreciated.

+5
source share
1 answer

A simple way (if you don't have many columns) would be to use a literal array and filter the empty cells with the query. Something like that

 =join(", ", query({C3:C; D3:D; E3:E; F3:F}, "where Col1 <>''")) 

Also see cell A1 in the general table.

UPDATED: An alternative (and shorter) way would be to use textjoin ()

 =textjoin(", ", 1, C2:F) 
+11
source

Source: https://habr.com/ru/post/1261206/


All Articles