Locked lesson.
About this lesson
Exercise files
Download this lesson’s related exercise files.
05-02-Combine Data with CONCAT and TEXTJOIN-Start.xlsx13 KB 05-02-Combine Data with CONCAT and TEXTJOIN-Complete.xlsx
14.5 KB 5.02 combine-data-with-concat-and-textjoin - Exercise.docx
43.5 KB Exercise - Combine Data with CONCAT and TEXTJOIN.xlsx
17.8 KB 5.02 combine-data-with-concat-and-textjoin - Exercise solution.docx
211.3 KB Exercise Solution - Combine Data with CONCAT and TEXTJOIN.xlsx
18.8 KB
Quick reference
Combine Data with CONCAT and TEXTJOIN
Learn how to use Excel text functions, CONCAT and TEXTJOIN to combine text from several cells into one cell.
When to use
We use these functions whenever we need to join text from different cells together. It's particularly useful when cleaning and tidying data ready for analysis.
Instructions
Let's look at 3 methods for joining text from different cells.
The Ampersand (&)
We can use the ampersand (&) symbol to quickly join text together.
In this example, we need to join the first name, middle name and last name together in cell F8. We use the ampersand (&) in between each cell we want to join.
We need to ensure that we specify spaces between the names. Spaces need to be enclosed within quote marks.
- Press Enter and copy the formula down.
Notice that two of the people in the list do not have middle names. This means there will be an additional space between their first name and last name. We can remove these by using the TRIM function.
- Press F2 to edit the formula.
- Press Enter and copy the formula down.
The CONCAT Function
We can also use the CONCAT function to join text together. CONCAT works in a similar way to ampersand (&).
- Press Enter and copy the formula down.
We will have the same issue with erroneous spaces for people who don't have a middle name. Add TRIM to the formula.
The TEXTJOIN Function
TEXTJOIN is a newer function in Excel that was released in Excel 2019.
TEXTJOIN differs from CONCAT in that we join data together on one line and specify the delimiter we want to use to separate each item. We can also use cell ranges instead of individual cells.
In this example, we want to put all the names on one line and separate them with a comma.
The TEXTJOIN function has three arguments:
delimiter - this is the delimiter we want to use to separate each item.
ignore_empty - this allows us to ignore any empty cells in the data.
text1 - this is the cell range we want to output.
We specify our delimiter (comma space), we are going to ignore empty cells and then we select the cell range.
This is the result.
Advanced TEXTJOIN
We can combine TEXTJOIN with other functions to make it more powerful.
In this example, we want to select a Project and return the members of that project on one line.
To do this, we need to combine TEXTJOIN with IF.
This formula says if the project name in cells K7:K23 matches the project name in cell N6, output the member names, if not, output a blank.
The TEXTJOIN part of the formula simply tells Excel to put the results on one line separated with a comma space.
The formula is dynamic so when the Project changes the Members also change.
Hints & tips
- The CONCAT function is known as CONCATENATE in older versions of Excel. CONCATENATE is still available to use as a legacy function.
Lesson notes are only available for subscribers.