TEXTJOIN in Excel: Mastering Text Concatenation

Unlock the potential of Excel’s TEXTJOIN function and revolutionize the way you handle text manipulation! Say goodbye to scattered data across cells and embrace the simplicity of merging text effortlessly. Dive into our comprehensive guide to discover how TEXTJOIN transforms your concatenation woes into seamless, efficient solutions. Master the art of combining text strings in Excel like a pro—simplify, streamline, and elevate your spreadsheet game with TEXTJOIN!

Understanding TEXTJOIN

At its core, TEXTJOIN is a versatile function that adeptly merges text from multiple cells or ranges, allowing you to specify a delimiter for separation. Whether it’s combining names, addresses, or any text-based data, TEXTJOIN swoops in to save the day.

Let’s dissect the TEXTJOIN function:

=TEXTJOIN(delimiter, ignore_empty, text1, [text2], …)
  • Delimiter: The separator between each text item. This could be any character, multiple characters (such as comma and a space character) or even a link to another cell.
  • Ignore_empty: An optional parameter to exclude empty cells from the concatenation. I have found this quite helpful to just skip empty cells.
  • Text1, [Text2], …: The cells or ranges containing the text to join. For example, you could link to many other cells and the textjoin function merges them, using the delimiter you have specified before.

Examples for TEXTJOIN

Let’s take a look at two simple examples.

Example 1: Simple concatenate using the TEXTJOIN function

Simple Example for the TEXTJOIN function in Excel.
Simple Example for the TEXTJOIN function in Excel.

The goal is to combine first- and last name into a new column. The first name is in column B, last name in column C. The TEXTJOIN function is quite straight-forward:

=TEXTJOIN(" ",TRUE,TRIM(B4:C4))
  • The delimiter is just two quotation marks with a space in-between. This will add the space character to the name.
  • In this case, the second argument does not really matter. The default value is TRUE, which means that empty cells will be ignored. So, you could even skip it, by just typing =TEXTJOIN(” “,,TRIM(B4:C4)). But make sure to have then two commas so that the third argument is the cell range that should be combined.
  • The last argument is the cell range. For cell E4, itIn this case cell B4 to C4.

Example 2: TRIM text and use a comma as seperator

In the next example, we take the previous TEXTJOIN function a bit further. We want to modify it a bit:

  • It shoule “clean” the text: remove and unnecessary space characters (highlighted in yellow).
  • Add a comma between last- and firstname.
Clean (TRIM) the text within the TEXTJOIN function.
Example 2: Clean (TRIM) the text within the TEXTJOIN function.

For cleaning the text by unnecssary space characters, we use the TRIM function:

=TEXTJOIN(", ",TRUE,TRIM(B4:C4))
  • The first argument is the delimiter. Because we want to separate the family name from the first name with a comma, we type “, ” (comma + space character in quotation marks).
  • TRUE is the same as in example 1 above.
  • Wrapping the cell reference with in the TRIM function “cleans” any unwanted / unnecessary spaces.

Take it a step further: Advanced Techniques

The UNIQUE function in Excel extracts unique values from a range or array. When paired with TEXTJOIN, it becomes a powerful tool for creating concatenated strings of distinct values.

Example: Concatenating Unique Items Suppose you have a list of items in column A, and you want to create a string that contains all unique items, separated by commas. Here’s how you can do it:

  1. Use UNIQUE to extract unique values from the list: =UNIQUE(A:A)
  2. Then, use TEXTJOIN to concatenate these unique values: =TEXTJOIN(", ", TRUE, UNIQUE(A:A))

This formula combines the unique items into a single string, separated by commas, making it easy to generate a summarized list of unique elements from your dataset.

TEXTJOIN with FILTER:

The FILTER function allows you to extract data from a range based on specific criteria. When coupled with TEXTJOIN, it enables the creation of concatenated strings based on filtered conditions.

Example: Concatenating Filtered Data Let’s say you have a list of sales regions (column A) and corresponding sales amounts (column B). You want to create a string that includes sales amounts for a specific region.

  1. Use FILTER to extract sales amounts for a particular region: =FILTER(B:B, A:A="RegionName")
  2. Then, utilize TEXTJOIN to concatenate these filtered sales amounts: =TEXTJOIN(", ", TRUE, FILTER(B:B, A:A="RegionName"))

This formula filters the sales amounts based on the specified region (“RegionName”) and combines them into a single string with commas as separators. It’s an efficient way to summarize data for specific criteria.

Example 3: Combining TEXTJOIN with a LOOKUP function

Our third example for TEXTJOIN shows the magic of combining TEXTJOIN with a LOOKUP function.

As you can see, we want to combine multiple cells, depending on a lookup. In this case, we will combine all continents a person has visited from a list into a single cell. Therefore, we use the still rather new SPIL function “FILTER” within TEXTJOIN.

=TEXTJOIN(", ",TRUE,FILTER($C$4:$C$8,$B$4:$B$8=E4))
  • The delimiter as – like in example 2 above – comma and a space in quotation marks.
  • Again, the second argument is TRUE or just type nothing.
  • The third argument is the cell range. Here, we insert the FILTER function which allows to filter the list in range B4 to C8 to only return the continents for the first person (i.e. “Joe”).
    Because Joe has visited three continents (Europe, North Amercia and Asia), these three items are now joined into one cell and separated by a comma.

Benefits:

  • Streamlined Data Summarization: Combine TEXTJOIN with UNIQUE and FILTER to quickly create summarized lists and concatenated strings based on unique values or specific criteria.
  • Enhanced Data Presentation: Generate clean, formatted strings suitable for reports or presentations by extracting and combining filtered or unique data elements.

By harnessing the capabilities of TEXTJOIN alongside UNIQUE and FILTER functions, Excel users can efficiently manipulate and present data, providing concise summaries and tailored information based on specific conditions or unique values within their datasets.

TEXTJOIN, CONCAT, CONCATENATE, and the “&” operator in Excel

TEXTJOIN: Use TEXTJOIN when you need to merge text from multiple cells or ranges while specifying a delimiter. It’s incredibly handy for combining various pieces of text, like names, addresses, or any scattered data across cells, with control over the separator.

CONCAT: If you’re using Excel 2019 or later, CONCAT is a simpler alternative to CONCATENATE and offers more functionality by allowing the combination of text from different cells or ranges without specifying a delimiter. It’s ideal when you need a straightforward text concatenation without the need for specific separators.

CONCATENATE: CONCATENATE serves a similar purpose to CONCAT and is available in earlier Excel versions. It’s useful for joining text from multiple cells or ranges together, but it requires explicit use of delimiters if needed, unlike CONCAT which doesn’t need them.

“&” Operator: The “&” operator (ampersand) is an efficient way to concatenate text in Excel formulas. It’s perfect for combining a few cell values or fixed text strings without complex requirements for delimiters. It’s straightforward and intuitive for simple concatenation tasks within formulas.

In summary, choose TEXTJOIN when you need controlled concatenation with delimiters and multiple cells. Use CONCAT (if available) for straightforward concatenation without delimiters in newer Excel versions. CONCATENATE can be used for similar purposes in earlier versions, but it requires explicit delimiters. Finally, the “&” operator is excellent for simple concatenation within formulas without the need for specific delimiters or complex configurations. Each has its strengths, so pick the one that best fits your specific concatenation needs in Excel.

For more information about concatenating text, please also refer to this article.

Conclusion

The TEXTJOIN function in Excel is a game-changer, simplifying text concatenation tasks with its flexibility and efficiency. Especially, combined with SPILL functions (like FILTER), it shows its great potential. Embrace its power to streamline your workflow and elevate your spreadsheet prowess. Remember, practice makes perfect—immerse yourself in TEXTJOIN’s capabilities and conquer your data manipulation challenges effortlessly.

Final Thoughts

Ready to transform your Excel experience? Share your insights, experiences, and additional tips for leveraging TEXTJOIN’s prowess in the comments below. Unleash the full potential of Excel’s TEXTJOIN and revolutionize the way you handle text concatenation tasks!

Image by Kerttu from Pixabay

Published
Categorized as General

Henrik Schiffner is a freelance business consultant and software developer. He lives and works in Hamburg, Germany. Besides being an Excel enthusiast he loves photography and sports.

Leave a comment

Your email address will not be published. Required fields are marked *