Summary

To combine a first name to a last name in Excel you can use the TEXTJOIN function. In the worksheet shown, the formulas in cell F5 and H5 look like this:

=TEXTJOIN(" ",1,B5,D5) // first and last
=TEXTJOIN(" ",1,B5:D5) // first, middle, and last

The first formula returns a full name composed of the first and last names. The second formula returns a full name composed of the first, middle, and last names. As these formulas are copied down, they return the results seen in columns F and H. See below for a detailed explanation.

Note: TEXTJOIN is only available in Excel 2019 or later. See below for formulas you can use in older versions of Excel.

Generic formula

=TEXTJOIN(" ",1,first,last)

Explanation 

In this example, the goal is to join different parts of a name (first, middle, last) into a full name. This is an example of concatenation. To concatenate means to join one text value to another with a formula, or in a more general programming language. In a current version of Excel, the simplest approach is to use the TEXTJOIN function, which is a flexible function for concatenating values in Excel. In an older version of Excel, you can use manual concatenation with the ampersand (&) operator, or you can use the older CONCATENATE function. The article below discusses all three approaches.

Note: Formulas that use concatenation in Excel are quite common, so it is a skill worth knowing. For a more detailed explanation of concatenation see How to concatenate in Excel.

TEXTJOIN solution

In the current version of Excel, the easiest way to join different parts of a name together is to use the TEXTJOIN function. To join the First name in column B to the Last name in column D together with TEXTJOIN the formula in cell F5 looks like this:

=TEXTJOIN(" ",1,B5,D5)

The inputs to TEXTJOIN are as follows:

  • delimiter - a single space (" ")
  • ignore_empty - 1, equivalent to TRUE
  • text1 - B5, the first name
  • text2 - D5, the last name

With this configuration, TEXTJOIN joins the first name in cell B5 to the last name in cell D5 together with a single space (" ") between them. If either value is empty, the ignore_empty argument set to 1 will cause TEXTJOIN to ignore the empty value and return the other value without a space.

You can easily adapt this formula to join all three names (first, middle, and last) together with TEXTJOIN. The formula used to perform this task in H5 looks like this:

=TEXTJOIN(" ",1,B5:D5)
  • delimiter - a single space (" ")
  • ignore_empty - 1, equivalent to TRUE
  • text1 - the range B5:D5

Note that in this case, we give TEXTJOIN the range B5:D5 as text1. TEXTJOIN will join all three values together separated by a single space (" "). Because ignore_empty is set to 1 (equivalent to TRUE in Excel), when a middle name is not present, TEXTJOIN will ignore that value and not add an extra space between the first and last names.

Note: newer versions of Excel also offer the CONCAT function (which replaces the CONCATENATE function in functionality). However, in this case, the TEXTJOIN function is a better option because it can automatically ignore empty values.

Manual concatenation solution

Join first and last names with manual concatenation

In an older version of Excel that does not offer the TEXTJOIN function, you can use manual concatenation with the ampersand (&) operator. This is often the technique used by more advanced users because it is simple and flexible. To join the first name in column B to the last name in column D together, you can use a formula like this:

=B5&" "&D5

The result is the first name in cell B5 joined to the last name in cell D5 separated by a space (" "). To use the manual concatenation to join the first, middle, and last names together, the formula in H5 is a bit more complex:

=B5&" "&IF(C5<>"",C5&" ","")&D5

At the core, this formula is similar to the first formula above. We begin with the first name in B5 and end with the last name in cell D5. However, to avoid adding an extra space when the middle name is blank we use the IF function to apply some conditional logic like this:

IF(C5<>"",C5&" ","")

The translation for this formula is: If cell C5 is not empty, return the value in C5 joined to a single space. If C5 is empty, return an empty string (""). In other words, if there is a middle name, add it with a space, otherwise, add nothing.

Note: When you use concatenation in a formula, be sure to enclose any literal text in double quotes (""). However, do not enclose the ampersand (&) or cell references in quotes.

CONCATENATE solution

Join first and last names with CONCATENATE function

Another way to solve this problem is with the older CONCATENATE function. In the worksheet below the formula in cell F5 is:

=CONCATENATE(B5," ",D5)

And the formula in H5 looks like this:

=CONCATENATE(B5," ",IF(C5<>"",C5&" ",""),D5)

In the formula above, we aren't able to avoid using the ampersand (&) entirely, because we still need the conditional logic created by the IF function to avoid adding extra space when the middle name is not present. This is something that TEXTJOIN handles automatically, which makes it a better option in more current versions of Excel.

Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.