Excel: Use TEXTJOIN IF Formula


You can use the TEXTJOIN function in Excel to combine multiple text values using a specific delimiter.

If you only want to combine cells based on criteria, you can use the TEXTJOIN function with the IF function as follows:

=TEXTJOIN(", ",TRUE,IF(B2:B11="Western",A2:A11,""))

This particular formula combines the text values in the range A2:A11 only if the corresponding cell in the range B2:B11 is equal to “Western.”

The following example shows how to use this formula in practice.

Example: How to Use TEXTJOIN IF in Excel

Suppose we have the following dataset in Excel that contains information about various professional basketball teams:

Suppose we would like to combine each of the team names into one cell, only if the team belongs to the Western conference.

We can type the following formula into cell D2 to do so:

=TEXTJOIN(", ",TRUE,IF(B2:B11="Western",A2:A11,""))

The following screenshot shows how to use this formula in practice:

Excel TEXTJOIN IF

Cell D2 has joined together each of the team names that belong to the Western conference, with a comma used as a delimiter.

If we view the original dataset, we can confirm that each of the teams included in cell D2 do indeed belong to the Western conference:

Note #1: To use a different delimiter to join together the text values, simply specify that delimiter in the first argument of the TEXTJOIN function.

x