How to Use the TEXTJOIN Function in Excel

Excel offers a wide range of functions that can help you manipulate data in various ways. One such function is TEXTJOIN, which, as the name implies, allows you to join text using a separator. It can be particularly useful when you need to perform data summary tasks in Excel.

In this article, we will discuss the TEXTJOIN function in detail and provide example cases that demonstrate how to use TEXTJOIN in your Excel sheets.

4

Syntax and Parameters of the TEXTJOIN Function

The TEXTJOIN function in Excel allows you to combine text from multiple cells into a single cell, with customizable delimiters and options. Here’s the syntax for the TEXTJOIN function:

Let’s break down each parameter of the function:

Excel logo with a sum symbol watermark

The TEXTJOIN function concatenates the text strings in the order you specify and separates them with the specified delimiter. It excludes any empty cells unless theignore_emptyparameter is set to FALSE.

​Example Cases Using the TEXTJOIN Function in Excel

Here are a few examples of cases where you can use the TEXTJOIN function:

1. Combining Text

Suppose you have a worksheet with first names in column A and last names in column B. You want to create a list of full names in column C. In cellC2, you’re able to use the following formula:

Copy the formula down the column, and it will combine the first name and last name from each row into a single cell, separated by a space.

Combining text in Excel using the TEXTJOIN function

2. Creating a Comma-Separated List

Let’s say you have a vertical list of cities, and you want to create a single cell that combines these cities into a comma-separated list. To achieve this, you can use the TEXTJOIN function with a comma as the delimiter.

Each city in the rangeA2:A7is combined using the comma and space delimiter specified within the double quotes. The second argument, TRUE, ignores any blank cells in the range.

Creating a list using Excel’s TEXTJOIN function

3. Adding Prefixes or Suffixes

If you have a column of data and want to add a specific prefix or suffix to each entry, you could use TEXTJOIN. Suppose you have a list of course numbers in column A, and you want to add the prefixMATto the numbers to make them course codes. You’ll use the following formula:

This formula concatenates the prefixMATwith the value in cellA2using the ampersand (&) operator.

Adding a prefix to numeric data using TEXTJOIN

4. Inserting Line Breaks Between Text

Suppose you have a table with employee information, including their names and email addresses. You want to create a summary report where each employee’s information is merged into a single cell with line breaks.

Assuming the names are in column A, and email addresses in column B, enter the formula below in cellC2:

PressCtrl + Shift + Enterto apply the formula to your table. Now, column C will display the merged information for all employees, separating each entry with a line break. TheCHAR(10)function generates the line break character that separates each employee’s information. For the information to show in multiple lines, as shown above, ensure that theWrap Textfeature is enabled.

These are just a few examples of how you can use TEXTJOIN to combine text strings in various ways. It offers flexibility in combining text and allows you to specify any delimiter of your choice for the desired output.

How to Use TEXTJOIN With Other Functions in Excel

TEXTJOIN works better withessential functions in Excelfor advanced data manipulations. Here are some examples:

Using TEXTJOIN With the IF Function

You canuse the IF functionwithin the TEXTJOIN function to conditionally include or exclude text strings based on certain criteria.

Let’s say you have a list of students' names in column A, their corresponding scores in column B, and their grades in column C. You want to create a single cell containing the names of students who have a score above80and have received an “A” grade, separated by a comma. In cellD1, you’re able to use the following formula:

After entering the formula in cellD2and confirming it withCtrl+Shift+Enter(since it’s an array formula), you’ll get a list of the students that meet the conditions specified. The formula uses the IF function to check if the corresponding score is above 80 (B2:B9>80) and the grade is A (C2:C9 = “A”).

If both conditions are true, it includes the student’s name in the result. Otherwise, it returns an empty string (""). The TEXTJOIN function then merges the selected names with a comma separating each as a delimiter.

Using TEXTJOIN With the SUBSTITUTE Function

Let’s say you have a list of product codes in column A, and you want to create a single string that combines all the codes, separated by commas, while removing any dashes (-) from the codes.

This formula uses the TEXTJOIN function to concatenate the product codes andthe SUBSTITUTE functionto remove the hyphens from the codes. You can adjust the range (A2:A6) in the formula based on your actual data. You can also modify the substitution criteria within the SUBSTITUTE function to replace different characters as needed.

Effortlessly Merge Data in Excel With TEXTJOIN

The TEXTJOIN function in Excel is a powerful tool that allows you to concatenate multiple text strings with a specified delimiter. By understanding its syntax and arguments, it’s possible to manipulate and combine data in a flexible and efficient manner. Whether you need to merge names, addresses, or any other text-based data, the TEXTJOIN function is a convenient solution.

Using multiple columns in Excel will save you the time of manually merging them. Here’s how to combine columns in Excel.

Make sure you don’t miss these movies and shows before Netflix removes them.

Your iPhone forgets what you copy, but this shortcut makes it remember everything.

Freeing up vital memory on Windows only takes a moment, and your computer will feel much faster once you’re done.

It’s not super flashy, but it can help to keep your computer up and running.

Free AI tools are legitimately powerful; you just need to know how to stack them.

Technology Explained

PC & Mobile