0
votes

I have a very simple table of three columns: table

I need to concat two of them (B and C) in separate cells like this: desired result desired result

I tried this formula: ==TEXTJOIN("-";TRUE;B1:C5) which does its work, but not the desired result. Please see the screenshot. The "D" column is what I get, and the "E" column is what I need to have: What I get: what i get

How do I achieve concatenating data of my columns in separate cells? Thanks.

1

1 Answers

1
votes

Try this

=ArrayFormula(IF(B:B <> "",B:B&"-"&C:C,""))

It will populate the row with the string concatenation operand & (same as CONCAT()) dynamically, and if the B cell is empty it will leave an empty cell.

enter image description here

If you by any means have a table header, you can always have the range go from B2:B, having the formula like this:

=ArrayFormula(IF(B2:B <> "",B2:B&"-"&C2:C,""))