Skip to content

TEXTJOIN

Joins text from cells and ranges with a separator between each item, and can skip empty cells.

Syntax

=TEXTJOIN(, , , [text2], ...)

Text

Excel 2019 and later, Excel for Microsoft 365, and Excel for the web. Not available in Excel 2016 or earlier.

Try it

Edit the formula in C2 or change the inputs. The sheet recalculates as you type.

C2
A
B
C
1
Attendee
Status
Invite list
2
Nora
Yes
Nora, Pieter, Imani, Callum
3
Pieter
Yes
4
Imani
No
5
Callum
Yes
6
7
8

C2 =TEXTJOIN(", ",TRUE,A2:A5) returns Nora, Pieter, Imani, Callum

How TEXTJOIN works

TEXTJOIN joins text with a separator between each item. It takes whole ranges, so you can turn a column of names into one comma-separated list in a single formula. It is the tidiest way to build a list, a tag string or an address line.

The arguments

  • delimiter is the separator, in quotes. ", " gives red, green, blue. An empty string "" joins with nothing between the items, which makes TEXTJOIN work like CONCAT.
  • ignore_empty is required. TRUE leaves out empty cells, so there are no doubled separators. FALSE keeps a separator for every empty cell. In most real lists, you want TRUE.
  • text1, text2, ... are the items. Each can be a cell, a range or typed text.

=TEXTJOIN(", ",TRUE,A2:A8) joins the whole range with commas and ignores the blanks.

Joining only some items

Because TEXTJOIN accepts arrays, you can join the items that pass a test. In Excel for Microsoft 365, =TEXTJOIN(", ",TRUE,IF(B2:B9>100,A2:A9,"")) lists the names whose value is above 100. The IF gives an empty string for the others, and ignore_empty removes them. In Excel 2019 this formula needs to be entered as an array formula with Ctrl+Shift+Enter.

TEXTJOIN with UNIQUE removes repeats from the list: =TEXTJOIN(", ",TRUE,UNIQUE(C2:C20)). That needs a version with dynamic arrays.

What it returns

TEXTJOIN returns text. Numbers inside the range are joined as they would look in a General-format cell, and dates join as serial numbers, so format them with TEXT first if they must look like dates. If any argument is an error, the result is that error. If the joined text exceeds 32,767 characters, the result is #VALUE!.

TEXTJOIN, CONCAT and the & operator

CONCAT and the ampersand put nothing between items and cannot skip blanks. For a name with an optional middle name, =A2&" "&B2&" "&C2 leaves two spaces in a row when B2 is empty. =TEXTJOIN(" ",TRUE,A2:C2) handles it correctly.

TEXTJOIN does the opposite of TEXTSPLIT: one splits text at a separator into cells, the other joins cells with a separator into text.

Line breaks

To put each item on its own line inside the cell, use CHAR(10) as the delimiter and turn on Wrap Text for the cell: =TEXTJOIN(CHAR(10),TRUE,A2:A5).

Arguments

delimiter
The separator to put between items, in quotes: ", ", " / ", "-". Use "" for no separator.
ignore_empty
TRUE skips empty cells, so you don't get doubled separators. FALSE keeps them, which leaves an extra separator for every gap.
text1
The first item to join: a cell, a range such as B2:B9, or text in quotes.
text2, ...optional
More items or ranges to join, in order.

Examples

Each example is a live sheet. Change the inputs or the formula and watch the result.

Example 1

A comma-separated list from a column

C2 =TEXTJOIN(", ",TRUE,A2:A5)

Result: Nora, Pieter, Imani, Callum

One range, one separator. The formula keeps working if you add names inside the range.

C2
A
B
C
1
Attendee
Status
Invite list
2
Nora
Yes
Nora, Pieter, Imani, Callum
3
Pieter
Yes
4
Imani
No
5
Callum
Yes
6
7
8

C2 =TEXTJOIN(", ",TRUE,A2:A5) returns Nora, Pieter, Imani, Callum

Example 2

Skip an empty middle name

D2 =TEXTJOIN(" ",TRUE,A2:C2)

Result: Anya Kowalski

B2 is empty, and ignore_empty is TRUE, so there is only one space between the names. With FALSE, the result would be "Anya Kowalski" with two spaces.

D2
A
B
C
D
1
First
Middle
Last
Full name
2
Anya
Kowalski
Anya Kowalski
3
Hugo
Daniel
Reyes
4

D2 =TEXTJOIN(" ",TRUE,A2:C2) returns Anya Kowalski

Example 3

List only the items that meet a condition

D2 =TEXTJOIN(", ",TRUE,IF(B2:B6>5000,A2:A6,""))

Result: Roof repair, Network cabling, Fleet servicing

IF returns an empty string for projects at or under 5,000. ignore_empty removes them. Excel 2019 needs this entered with Ctrl+Shift+Enter.

D2
A
B
C
D
1
Project
Overspend
Over 5,000
2
Roof repair
7,200
Roof repair, Network cabling, Fleet servicing
3
Signage
800
4
Network cabling
5,600
5
Training
0
6
Fleet servicing
9,100
7
8

D2 =TEXTJOIN(", ",TRUE,IF(B2:B6>5000,A2:A6,"")) returns Roof repair, Network cabling, Fleet servicing

Example 4

Put each item on its own line

C2 =TEXTJOIN(CHAR(10),TRUE,A2:A4)

Result: Count stock Reconcile deliveries Update reorder sheet

CHAR(10) is a line break. Turn on Wrap Text in the cell to see the three lines.

C2
A
B
C
1
Task
Owner
Checklist
2
Count stock
Count stock Reconcile deliveries Update reorder sheet
3
Reconcile deliveries
4
Update reorder sheet
5
6

C2 =TEXTJOIN(CHAR(10),TRUE,A2:A4) returns Count stock Reconcile deliveries Update reorder sheet

Your turn.

Solve it in the sheet. Every answer is checked, with hints if you need them.

Task 1 of 2

In E2, list Hana's shifts from C2:D2 as one text, separated by a comma and space.

Answer in E2.

E2
A
B
C
D
E
1
Crew member
Certified
Shift 1
Shift 2
Shift list
2
Hana
Yes
Mon
Wed
3
Marcus
No
Tue
4
Ines
Yes
Mon
Thu
5
Gareth
Yes
6
7
8
Certified crew

Common mistakes

  • ignore_empty is required. =TEXTJOIN(", ",A2:A8) is rejected for having too few arguments. Always give TRUE or FALSE as the second argument, then the items.
  • With ignore_empty set to FALSE, every empty cell leaves a separator behind: "Anya, , Kowalski". Use TRUE for lists with gaps.
  • Cells that look empty but contain a formula returning "" or a space are not empty. "" is skipped when ignore_empty is TRUE, but a cell holding a single space is kept. Clean such cells with TRIM first.
  • Dates and formatted numbers join as stored values, not as displayed. Wrap them in TEXT(range, "format") to keep the look.
  • In Excel 2019, using TEXTJOIN with IF over a range needs Ctrl+Shift+Enter. In Microsoft 365 it works as a normal formula.
  • The result is capped at 32,767 characters. Past that, TEXTJOIN returns #VALUE!.

Questions people ask

How do I combine cells with a comma in Excel?

Use TEXTJOIN with a comma as the delimiter: `=TEXTJOIN(", ",TRUE,A2:A10)`. Set the second argument to `TRUE` to skip any empty cells.

What is the difference between TEXTJOIN and CONCAT?

CONCAT joins items with nothing between them. TEXTJOIN adds a delimiter between items and can ignore empty cells. Both accept ranges.

Can TEXTJOIN join only cells that meet a condition?

Yes. Wrap the range in IF: `=TEXTJOIN(", ",TRUE,IF(B2:B9="Yes",A2:A9,""))`. In Excel 2019 enter it with Ctrl+Shift+Enter. Microsoft 365 handles it as a normal formula.

Why does TEXTJOIN return #NAME?

Your version of Excel doesn't have it. TEXTJOIN needs Excel 2019 or later, or Microsoft 365. In Excel 2016 you would need a long chain of `&` operators or a macro.

How do I put each item on a new line?

Use `CHAR(10)` as the delimiter, for example `=TEXTJOIN(CHAR(10),TRUE,A2:A5)`, and turn on Wrap Text in the cell.

Learn TEXTJOIN in a real sheet.

TEXTJOIN is taught in Logic and text, lesson 16: TEXTJOIN. Each lesson is a short, graded exercise like the one above.