Lesson 17 of 92 · Free Excel Course
Excel
Concatenate in Excel: Join, Split and Clean Up Text with Formulas
How to concatenate in Excel with &, CONCAT and TEXTJOIN, then split, trim, change case and replace text. Free practice workbook included.
A lot of spreadsheet work isn't math at all. It's text: first and last names in separate columns that you need together, product codes you need to pull apart, a list pasted from a website full of stray spaces. Excel has a small set of text functions for exactly this. In this lesson you'll concatenate (join) text with the & sign, CONCAT and TEXTJOIN, then split it back up, trim it, fix capital letters and replace bits of it. Each formula works on one cell, and you copy it down the column just like the formulas from earlier lessons.
Join text with the & sign
The quickest way to join two cells is the & sign (Shift+7). Think of it as "glued to". Say first names are in column A and last names in column B.
- Click C2, where the full name should go.
- Type
=A2&" "&B2. - Press Enter (Return on a Mac). C2 shows Ann Lee.
- Drag the fill handle (the small square at the bottom-right of C2) down to copy the formula to the other rows.
| A | B | C | |
|---|---|---|---|
| 1 | First | Last | Full name |
| 2 | Ann | Lee | Ann Lee |
| 3 | Raj | Patel | Raj Patel |
| 4 | Maria | Gomez | Maria Gomez |
| 5 | Tom | Ng | Tom Ng |
The " " in the middle matters. Anything inside double quotes is typed into the result exactly as written, so " " adds one space. Without it, =A2&B2 gives AnnLee. You can put any text in quotes: =B2&", "&A2 gives Lee, Ann, and ="Dear "&A2&"," gives Dear Ann,. Each piece needs its own & on both sides, which is the part people most often forget.
Mac and Excel for the web work exactly the same way. The & joins anything: cells, typed text in quotes, even the result of another formula, such as ="Total: "&SUM(B2:B6).
CONCAT, CONCATENATE and TEXTJOIN
If you prefer a function to a row of & signs, Excel has three.
CONCATENATE is the original: =CONCATENATE(A2," ",B2). It still works, but Microsoft says it has been replaced by CONCAT and is kept only so old workbooks keep working, and it may not be available in future versions. Don't start new work with it.
CONCAT does the same job and also accepts a range: =CONCAT(A2," ",B2) gives Ann Lee, and =CONCAT(A2:C2) joins three cells in one go, though with nothing between them. It works in Excel 2019 and later, Microsoft 365 and Excel for the web.
TEXTJOIN is the one to learn. You tell it the separator once, and whether to skip empty cells:
=TEXTJOIN(" ",TRUE,A2:C2)
" "is the delimiter, the text placed between each item. Use", "for a comma and space.TRUEis ignore_empty: skip blank cells. FALSE would keep them and add an extra separator.A2:C2is the text to join. It can be a range, single cells or both.
Here is why ignore_empty is so useful. Raj and Tom have no middle name.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | First | Middle | Last | With & | With TEXTJOIN |
| 2 | Ann | Marie | Lee | Ann Marie Lee | Ann Marie Lee |
| 3 | Raj | Patel | Raj Patel | Raj Patel | |
| 4 | Maria | Elena | Gomez | Maria Elena Gomez | Maria Elena Gomez |
| 5 | Tom | Ng | Tom Ng | Tom Ng |
TEXTJOIN needs Excel 2019 or later, a Microsoft 365 subscription, or Excel for the web. On older versions, stick with &.
Put dates and money into a sentence with TEXT
Joining a date to text has a nasty surprise. If B2 holds the date 12/15/2026, ="Due "&B2 shows Due 46371. Joining drops the cell's formatting, and underneath, every date is a serial number (the count of days since the start of 1900, as covered in Dates and times). Money does the same: $1,250.00 comes out as 1250.
The fix is the TEXT function, which turns a number into text in the format you choose: TEXT(value, format_text).
- Click the cell for the sentence.
- Type
="Due "&TEXT(B2,"m/d/yyyy"). - Press Enter. You get Due 12/15/2026.
The format code goes in quotes and uses the same codes as Format Cells: "mmmm d, yyyy" gives December 15, 2026, "dddd" gives the weekday name, and "$#,##0.00" gives $1,250.00. Put both together:
="Due "&TEXT(B2,"m/d/yyyy")&", "&TEXT(C2,"$#,##0.00") gives Due 12/15/2026, $1,250.00.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 23 | Invoice | Due date | Amount | Joined plainly | Joined with TEXT |
| 24 | INV-104 | 12/15/2026 | $1,250.00 | Due 46371 | Due 12/15/2026, $1,250.00 |
The result of TEXT is text, not a number, so you can't do math with it afterwards. Keep the real date and amount in their own cells and use TEXT only in the sentence.
Pull out part of a cell: LEFT, RIGHT, MID and LEN
These four take text apart by counting characters. Take the product code TW-2026-BLU in A12.
=LEFT(A12,2)takes 2 characters from the left: TW. Leave out the number and you get just 1 character.=RIGHT(A12,3)takes 3 from the right: BLU.=MID(A12,4,4)starts at character 4 and takes 4: 2026. The pattern isMID(text, start_num, num_chars). Count every character, including the dashes.=LEN(A12)counts the characters: 11. Spaces count too, which makes LEN a handy way to spot hidden spaces.
Everything these functions return is text, even 2026. If you need it as a number, see the common mistakes below.
Clean up: TRIM, UPPER, LOWER and PROPER
Text pasted from other places is often messy. TRIM removes spaces at the start and end and squeezes runs of spaces in the middle down to one. If A8 holds the words ann and lee with two spaces in front, three in the middle and one at the end, =TRIM(A8) turns it into ann lee. Check it with LEN: the messy version is 12 characters long, the trimmed one 7.
One catch, which Microsoft points out on its TRIM page: TRIM doesn't remove the non-breaking space (character 160) that web pages use. If TRIM seems to do nothing on text copied from a browser, swap those for normal spaces first: =TRIM(SUBSTITUTE(A8,CHAR(160)," ")).
Three functions fix capital letters:
=UPPER(A2)makes everything capitals: ANN LEE.=LOWER(A2)makes everything small letters: ann lee.=PROPER(A2)capitalizes the first letter of each word: RAJ PATEL becomes Raj Patel.
You can nest them: =PROPER(TRIM(A8)) cleans and capitalizes in one step. PROPER isn't perfect with names like McDonald or O'Neil, so glance over the results.
Split one cell into several columns
Splitting is the opposite of joining. There are several ways, depending on your Excel.
TEXTSPLIT splits with a formula. With Austin, TX, 78701 in A18, type =TEXTSPLIT(A18,", ") in B18. The result spills into B18, C18 and D18: Austin, TX and 78701. The cells to the right must be empty, or you'll see #SPILL!. TEXTSPLIT is available in Excel for Microsoft 365 (Windows and Mac), Excel 2024 and Excel for the web. It isn't in Excel 2021 or older.
TEXTBEFORE and TEXTAFTER grab the part on one side of a character. With ann.lee@example.com in A15, =TEXTBEFORE(A15,"@") gives ann.lee and =TEXTAFTER(A15,"@") gives example.com. If the character isn't there, they show #N/A. Same versions as TEXTSPLIT.
Text to Columns works in every version and changes the cells themselves, no formula:
- Select the cells to split.
- On the Data tab, click Text to Columns.
- Choose Delimited and click Next.
- Tick the separator, such as Comma or Space, and check the preview.
- Click Next, set the Destination cell if you don't want to overwrite the original, and click Finish.
Text to Columns writes into the columns to the right, replacing anything there, so leave them empty. Microsoft lists it for Excel for the web as well as Windows; on a Mac, look for the same button on the Data tab.
Flash Fill is the no-formula shortcut. Type the result you want in the first row, say just the first name, and press Ctrl+E (or Data > Flash Fill). Excel spots the pattern and fills the rest. It's covered in Entering data and AutoFill. Flash Fill doesn't update if the original text changes; formulas do.
Replace text: SUBSTITUTE and Find & Replace
SUBSTITUTE swaps one piece of text for another inside a formula: SUBSTITUTE(text, old_text, new_text). With 555-201-3344 in A21, =SUBSTITUTE(A21,"-",".") gives 555.201.3344. Use "" as the new text to delete something: =SUBSTITUTE(A21,"-","") gives 5552013344. Add a fourth number to replace only one occurrence: =SUBSTITUTE(A21,"-",".",1) changes just the first dash.
Find & Replace changes the cells themselves:
- Select the cells (or one cell to search the whole sheet).
- Press Ctrl+H, or go to Home > Find & Select > Replace.
- Type what to find in Find what and the new text in Replace with.
- Click Replace All.
On a Mac, Microsoft gives the shortcut as Control+H, and the button is under Home > Find & Select. Excel for the web uses Ctrl+H too. There are more shortcuts on the Excel shortcuts cheat sheet.
Try it yourself
Download the practice workbook and open the Practice sheet. Yellow cells are where you type.
- In F2 type
=TEXTJOIN(" ",TRUE,A2:C2)and copy it down to F5. Raj Patel has no double space. In G2 type=C2&", "&A2and in H2 type=CONCAT(D2,", ",E2), then copy both down. - In B8 type
=TRIM(A8), in C8=PROPER(B8), and in D8 and E8 compare=LEN(A8)with=LEN(B8): 12 and 7. Copy row 8 down to row 9. - In B12:D12 pull TW, 2026 and BLU out of the code with LEFT, MID and RIGHT.
- In B15 and C15 split the email with TEXTBEFORE and TEXTAFTER.
- In B18 type
=TEXTSPLIT(A18,", ")and watch it spill. In B21 replace the dashes with dots using SUBSTITUTE. - In D24 type
="Due "&B24and see 46371. In E24 fix it with TEXT to get Due 12/15/2026, $1,250.00.
Check your work against the Answers sheet. If TEXTSPLIT, TEXTBEFORE or TEXTAFTER shows #NAME?, your version doesn't have them; use Text to Columns or Flash Fill instead.
Common mistakes
- Forgetting the space.
=A2&B2gives AnnLee. Add" "between the parts. - Missing quotes or &.
=A2&" "B2is an error. Every piece needs an & on each side, and text needs quotes on both ends. - Joining a date or price directly. You get a serial number or lose the $ sign. Wrap it in TEXT.
- Doing math on text results. LEFT, MID and TEXT return text. To turn "2026" back into a number, use
=VALUE(MID(A12,4,4))or add zero:=MID(A12,4,4)+0. - TRIM "not working". Usually it's a non-breaking space from a web page. Use SUBSTITUTE with CHAR(160) first.
- Overwriting data with Text to Columns. It fills the columns to the right without asking. Leave them empty or pick another Destination.
- Deleting the original column. A formula like
=A2&" "&B2breaks if you delete A or B. Copy the results and use Paste Values first if you need to remove the originals.
What's next
You can now join, split and tidy text, which also makes your counts from COUNTIF, SUMIF, AVERAGEIF more reliable, since a stray space is enough to stop a match. Next comes VLOOKUP and HLOOKUP, where clean text matters even more: one hidden space and a lookup can't find what's right in front of it. You can also return to the full Excel course. For one function at a time, see the FIND, SEARCH, LEN, CLEAN and EXACT reference pages.
Frequently asked questions
How do I combine first and last name in Excel with a space?
If the first name is in A2 and the last name in B2, type =A2&" "&B2 and press Enter. The " " in the middle is a space in quotes. You can also use =CONCAT(A2," ",B2). Copy the formula down to do the whole list.
What is the difference between CONCATENATE, CONCAT and TEXTJOIN?
CONCATENATE is the old function and only takes single cells. CONCAT replaced it and also accepts ranges like A2:C2. TEXTJOIN goes further: you give it a separator once (such as a comma) and it can skip empty cells. All three join text; TEXTJOIN needs Excel 2019 or later.
Does CONCATENATE still work in Excel?
Yes. Microsoft keeps it for compatibility with older workbooks, but says it has been replaced by CONCAT and may not be available in future versions. Use CONCAT or the & sign in new work.
Why does my date turn into a number when I join it with text?
Joining drops the cell's formatting, so Excel shows the date's serial number (12/15/2026 is 46371). Wrap the date in TEXT to choose how it looks: ="Due "&TEXT(B2,"m/d/yyyy").
How do I split text in one cell into several columns?
Select the cells and use Data > Text to Columns, choose Delimited, tick the separator (comma, space and so on) and click Finish. In Excel for Microsoft 365, Excel 2024 and Excel for the web you can use a formula instead: =TEXTSPLIT(A2,", ").
Why doesn't TRIM remove all the spaces?
TRIM removes normal spaces only. Text copied from web pages often contains a non-breaking space (character 160), which TRIM leaves alone. Swap it for a normal space first: =TRIM(SUBSTITUTE(A2,CHAR(160)," ")).