Excel TEXTJOIN Function: Combine Cells With Commas, Conditions and Line Breaks

The Excel TEXTJOIN function puts the contents of many cells into one cell, with a comma, space or any other separator between them, and it can skip the blanks. One formula replaces a long chain of & signs. Every result on this page was worked out by hand from the 8-row list below, so you can type it in and compare.

Excel TEXTJOIN function combining eight names into one cell
Excel TEXTJOIN: eight cells joined into one with commas

TEXTJOIN syntax

=TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)

delimiter is what goes between the items. Type it inside quotes, such as ", " or " - ", or use "" to glue items together with nothing between them. ignore_empty is TRUE to skip empty cells and FALSE to keep a slot for each one. text1 and the arguments after it can be single cells, whole ranges, typed text or arrays from other formulas.

광고

The example list

Type this into A1:D9 with the headers in row 1. C6 is left empty on purpose.

A: NameB: TeamC: EmailD: Active
2AvaSalesava@example.comYes
3BenSupportben@example.comNo
4CaraSalescara@example.comYes
5DanDesigndan@example.comYes
6EliSupportYes
7FaySalesfay@example.comNo
8GusDesigngus@example.comYes
9HanaSupporthana@example.comYes

Combine a column with commas

=TEXTJOIN(", ",TRUE,A2:A9) returns Ava, Ben, Cara, Dan, Eli, Fay, Gus, Hana. For an address line you can paste into an email, use =TEXTJOIN("; ",TRUE,C2:C9). It returns seven addresses, because the empty C6 is skipped.

Change the second argument to FALSE and the empty cell keeps its place. On the four cells C4:C7, TRUE gives cara@example.com; dan@example.com; fay@example.com and FALSE gives cara@example.com; dan@example.com; ; fay@example.com. FALSE is the right choice when position matters, for example when you plan to split the text back into columns later.

TEXTJOIN ignore_empty TRUE and FALSE results compared
TEXTJOIN ignore_empty: TRUE skips the blank, FALSE keeps its slot
광고

TEXTJOIN with a condition

TEXTJOIN has no criteria argument, so the filtering happens inside the third argument. With IF, rows that fail the test become "", and TRUE then drops them:

=TEXTJOIN(", ",TRUE,IF(B2:B9="Sales",A2:A9,"")) returns Ava, Cara, Fay.

In Microsoft 365, Excel 2021 and later, press Enter. In Excel 2019, confirm it with Ctrl+Shift+Enter, because the IF works on a whole range at once.

TEXTJOIN with IF condition listing the Sales team
TEXTJOIN with a condition: only Sales rows are joined

If you have FILTER, the formula is easier to read, and two conditions are just two tests multiplied together:

=TEXTJOIN(", ",TRUE,FILTER(A2:A9,(B2:B9="Sales")*(D2:D9="Yes"),"None")) returns Ava, Cara. Fay is in Sales but not active.

For “either one” logic, add the tests instead of multiplying: =TEXTJOIN(", ",TRUE,FILTER(A2:A9,(B2:B9="Sales")+(B2:B9="Design"),"None")) returns Ava, Cara, Dan, Fay, Gus.

When nothing matches: the IF version returns an empty cell with no message. FILTER without its third argument returns an error, which is why the formulas above end with “None”.

Nothing matches and you useYou see
IF with "" as the last argumentAn empty cell
Excel FILTER with no fallback#CALC!
Excel FILTER with "None"None
Google Sheets FILTER#N/A (wrap in IFERROR)

Which formula works in your version

VersionTEXTJOINConditional join
Microsoft 365, web, Excel 2024 and 2021YesFILTER or IF, press Enter
Excel 2019YesIF with Ctrl+Shift+Enter, no FILTER
Excel 2016 and olderNot on Microsoft’s listJoin with & or a helper column
Google SheetsYesFILTER, or IF inside ARRAYFORMULA

No UNIQUE in Excel 2019? This formula, confirmed with Ctrl+Shift+Enter, keeps only the first appearance of each team: =TEXTJOIN(", ",TRUE,IF(MATCH(B2:B9,B2:B9,0)=ROW(B2:B9)-ROW(B2)+1,B2:B9,"")). It returns Sales, Support, Design, in the order they first show up.

One list per group

This is the report many people are really after: one row per team with all its members. Put =UNIQUE(B2:B9) in F2, which spills Sales, Support and Design. Then enter this in G2 and fill it down to G4:

=TEXTJOIN(", ",TRUE,FILTER($A$2:$A$9,$B$2:$B$9=F2))

Team (F)Members (G)Count
SalesAva, Cara, Fay3
SupportBen, Eli, Hana3
DesignDan, Gus2

The counts add up to 8, the number of people in the list. Make that check on your own sheet too.

TEXTJOIN and FILTER listing members of each team in one cell
One list per team with TEXTJOIN and FILTER

Sorted, unique, line breaks and dates

No repeats, A to Z: =TEXTJOIN(", ",TRUE,SORT(UNIQUE(B2:B9))) returns Design, Sales, Support.

One item per line: use =TEXTJOIN(CHAR(10),TRUE,A2:A4), then select the cell and turn on Home, Wrap Text. Without Wrap Text the cell looks like one long line. Google Sheets shows the breaks with the same CHAR(10).

Dates and money: TEXTJOIN reads the stored value, not the cell’s formatting, so a date comes out as a serial number such as 46357. If your dates sit in E2:E4, wrap the range in TEXT: =TEXTJOIN(", ",TRUE,TEXT(E2:E4,"mmm d")). Empty date cells get formatted too, so on a range with gaps use IF(E2:E4="","",TEXT(E2:E4,"mmm d")). In Excel 2019 both need Ctrl+Shift+Enter.

Two delimiters: the delimiter can be an array, and Excel uses its items in turn. =TEXTJOIN({": ","; "},TRUE,A2:B4) reads the range row by row and returns Ava: Sales; Ben: Support; Cara: Sales.

TEXTJOIN vs CONCAT vs &

MethodTakes a rangeAdds separatorsSkips blanks
TEXTJOINYesYes, onceYes
CONCATYesNoNothing to skip
CONCATENATENoType each oneNo
& operatorNoType each oneNo

For two or three cells, =A2&" "&B2 is perfectly fine. TEXTJOIN pays off from about four items, or when some of them may be blank.

TEXTJOIN errors and fixes

#NAME? means this Excel has no TEXTJOIN, the name is misspelled, or a word was typed without quotes. An error from the data passes straight through: one #N/A in the range turns the whole result into #N/A. Blanks that are not skipped usually hold a space; compare =LEN(C6) with 0. #VALUE! appears when the joined text is longer than a cell can hold, which is 32,767 characters. A condition formula that returns only the first row, or #VALUE!, in Excel 2019 usually needs Ctrl+Shift+Enter. A blank result means every item was empty or nothing matched, so check for trailing spaces in the criteria column.

Checklist for fixing TEXTJOIN errors in Excel
Checklist when a TEXTJOIN formula looks wrong

Google Sheets and splitting it back

Google Sheets has TEXTJOIN with the same first three arguments, so =TEXTJOIN(", ",TRUE,A2:A9) works as written. For a condition there, wrap the formula in ARRAYFORMULA when you use IF, or use FILTER. Sheets FILTER takes further conditions as extra arguments and has no “None” fallback, so the safe form is =IFERROR(TEXTJOIN(", ",TRUE,FILTER(A2:A9,B2:B9="Sales")),"None").

To go the other way in Excel, =TEXTSPLIT(G2,", ") breaks “Ava, Cara, Fay” back into three cells. TEXTSPLIT needs Microsoft 365, Excel 2024 or Excel for the web. In older versions, use Data, Text to Columns. A value that already contains a comma will be split in two, and numbers come back as text.

Frequently asked questions

How do I combine cells with a comma in Excel?

Use =TEXTJOIN(", ",TRUE,A2:A9). The first argument is the comma and space, TRUE skips blank cells, and the last one is the range.

Can TEXTJOIN use a condition?

Yes, by putting IF or FILTER inside it, for example =TEXTJOIN(", ",TRUE,IF(B2:B9="Sales",A2:A9,"")).

Why does TEXTJOIN show #NAME?

Your Excel version does not include the function, the name is misspelled, or a delimiter was typed without quotes.

How do I put each value on a new line?

Use CHAR(10) as the delimiter and turn on Wrap Text for the cell.

What is the difference between TEXTJOIN and CONCAT?

Both accept ranges. Only TEXTJOIN adds a separator for you and can skip empty cells.

Sources: Last checked December 2026. Microsoft Support: TEXTJOIN, FILTER, TEXTSPLIT; Exceljet: TEXTJOIN; Google: TEXTJOIN in Sheets, FILTER in Sheets.

광고

#ExcelTEXTJOIN  #TEXTJOIN  #CombineCells  #ConcatenateExcel  #ExcelFormulas  #DynamicArrays  #ExcelFILTER  #GoogleSheets  #ExcelTips  #MetaTrend

Found this useful? Share it.