Today, we are going to com­bine text with two, dif­fer­ent delim­iters. In our exam­ple, we have shop and street names. We want to put a semi­colon between each shop and street name. How­ev­er, between street and shop names we want to put anoth­er sym­bol, which is a pipe. What is impor­tant in our exam­ple, is the fact that not all cells are filled. We want to just ignore them while com­bin­ing text (Fig. 1).

Com­bine text with dif­fer­ent delimiters
Fig. 1 — Text to combine

This task is very sim­ple in Excel 2019 and new­er ver­sions because we have the TEXTJOIN func­tion. In the first argu­ment of this func­tion, we are putting the delim­iter. We can even put more than one delim­iter. In our exam­ple, the delim­iters are placed in cells D9 and E9, so let’s put them in the for­mu­la and let’s lock them by press­ing the F4 key. When we put more than one delim­iter in the TEXTJOIN func­tion, the func­tion will use them alter­na­tive­ly, which means that first, it will use the semi­colon, then the pipe, then the semi­colon and so on. In next argu­ment we have to decide whether we want to ignore emp­ty cells or not. In this case, as I said ear­li­er, it’s very impor­tant for us to ignore them, so we are writ­ing TRUE or 1. The last argu­ment we need is just text, i.e. the range with text. Let’s close the for­mu­la (Fig. 2)

=TEXTJOIN($D$9:$E$9,1,B2:G2)

Fig. 2 — For­mu­la for com­bin­ing text

After putting it into the cell, let’s copy it down. We have the results. We can see there are semi­colons between shop and street names, and pipes between street and shop names (Fig. 3).

Fig. 3 — Com­bined text

In the TEXTJOIN for­mu­la, delim­iters ori­en­ta­tion is not impor­tant. They can be hor­i­zon­tal or vertical.

We can even hard­code them here by select­ing first argu­ment and press­ing the F9 key to eval­u­ate it. Now, they are writ­ten as text (Fig. 4).

=TEXTJOIN({“;”,”|”},1,B2:G2)

Fig. 4 — Hard­code delimiters

We can leave them like that and the for­mu­la will work the same. 

https://www.youtube.com/watch?v=Euhk_dOil4Q