TEXTJOIN in Excel: Join a List and Skip Blanks
By ExcelReady TeamUpdated 7 min read
The short answer
To make TEXTJOIN ignore blanks, set its second argument to TRUE: =TEXTJOIN(", ",TRUE,A2:A7) joins the filled cells with a comma and space and skips the empty ones, so you never get double commas. With FALSE, empty cells are kept and leave gaps like "Excel, , SQL". TEXTJOIN needs Excel 2019 or later, or Microsoft 365.
Key takeaways
- The shape is =TEXTJOIN(delimiter, ignore_empty, text1, ...).
- TRUE as the second argument skips empty cells; FALSE keeps them and leaves extra delimiters.
- Cells holding "" from a formula count as empty and are skipped; cells holding a space are not.
- Join only matching rows with IF or FILTER inside TEXTJOIN.
- TEXTJOIN needs Excel 2019, Excel 2021, Excel 2024 or Microsoft 365.
On this page+
TEXTJOIN can ignore blanks for you: set its second argument to TRUE and empty cells are skipped, so a list joins cleanly with no double commas. =TEXTJOIN(", ",TRUE,A2:A7) turns a column with gaps into Excel, SQL, Power BI, Python. This guide covers the syntax, how it treats different kinds of "empty", and how to join only the rows that match a condition.
How does TEXTJOIN work?#
TEXTJOIN joins a list of values and puts the same separator between each one. The separator is called the delimiter. The syntax has three parts:
=TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...)| Part | What it means | Example |
|---|---|---|
| delimiter | What goes between items, in quotes | ", " |
| ignore_empty | TRUE to skip empty cells, FALSE to keep them | TRUE |
| text1, text2... | The cells, ranges or text to join | A2:A7 |
Unlike & or CONCAT, TEXTJOIN accepts a whole range at once. That makes it the easiest way to turn a column into one line. TEXTJOIN needs Excel 2019, Excel 2021, Excel 2024 or Microsoft 365. The comparison of CONCATENATE, CONCAT and TEXTJOIN shows how the three differ.
How to make TEXTJOIN ignore blank cells#
Put TRUE as the second argument. Here is a skills column with two empty rows:
| A | |
|---|---|
| 1 | Skill |
| 2 | Excel |
| 3 | |
| 4 | SQL |
| 5 | Power BI |
| 6 | |
| 7 | Python |
Compare the two settings:
| Formula | Result |
|---|---|
=TEXTJOIN(", ",TRUE,A2:A7) | Excel, SQL, Power BI, Python |
=TEXTJOIN(", ",FALSE,A2:A7) | Excel, , SQL, Power BI, , Python |
With FALSE, each empty cell still gets a delimiter on both sides, which leaves the , , gaps. In almost every real list you want TRUE.
FALSE is useful when the position matters, for example when you build a line for another system that expects a fixed number of fields, even empty ones.
What counts as blank for TEXTJOIN?#
TEXTJOIN skips truly empty cells and cells holding empty text, but not cells holding a space. This matters with real data:
| Cell contains | Skipped with TRUE? |
|---|---|
| Nothing at all | Yes |
A formula returning "" | Yes |
A single space " " | No |
| The number 0 | No |
The space is the usual reason a "blank" cell still adds a comma. You can't see it, but Excel can. In Microsoft 365, trim the range inside TEXTJOIN:
=TEXTJOIN(", ",TRUE,TRIM(A2:A7))TRIM turns a space-only cell into empty text, which TEXTJOIN then skips. In Excel 2019, enter that formula with Ctrl+Shift+Enter (Mac: Control+Shift+Return) so it works on the whole range.
How to join with a different delimiter#
The delimiter can be any text, and choosing it well makes the result easier to read. Some common choices:
| Delimiter | Formula | Use for |
|---|---|---|
| Comma and space | =TEXTJOIN(", ",TRUE,A2:A7) | Readable lists |
| Semicolon | =TEXTJOIN(";",TRUE,A2:A7) | Email address lists |
| Space | =TEXTJOIN(" ",TRUE,A2:C2) | First, middle, last name |
| Line break | =TEXTJOIN(CHAR(10),TRUE,A2:A4) | Address on several lines |
The space version is great for names where the middle name is often missing. =TEXTJOIN(" ",TRUE,A2:C2) gives Maria Lopez instead of Maria Lopez with two spaces. For other ways to do this, see joining text with a space.
For the line-break version, turn on Wrap Text in the cell so each part appears on its own line. On Excel for Mac, CHAR(10) also works for a line break.
How to join only the cells that match a condition#
Put IF inside TEXTJOIN to blank out the rows you don't want, then let TRUE skip them. Say A2:A8 holds names and B2:B8 says whether each person passed:
=TEXTJOIN(", ",TRUE,IF(B2:B8="Yes",A2:A8,""))IF returns the name where B is Yes and "" everywhere else. TEXTJOIN then joins the names and skips the empty text. In Microsoft 365 this works as a normal formula. In Excel 2019, confirm it with Ctrl+Shift+Enter.
In Excel 2021 or Microsoft 365, FILTER reads more clearly:
=TEXTJOIN(", ",TRUE,FILTER(A2:A8,B2:B8="Yes"))Add UNIQUE to drop repeated values: =TEXTJOIN(", ",TRUE,UNIQUE(A2:A8)) lists each name once.
One thing to watch with FILTER: if no row matches, FILTER returns #CALC! and TEXTJOIN passes the error on. Give FILTER its third argument so it returns empty text instead: FILTER(A2:A8,B2:B8="Yes",""). TEXTJOIN then returns an empty cell rather than an error.
How to skip blanks without TEXTJOIN#
In Excel 2016 or earlier, there is no TEXTJOIN, so you must handle each empty cell yourself. The usual way is an IF around every part:
=A2&IF(B2="",""," "&B2)&IF(C2="",""," "&C2)Each IF adds a space and the cell only when the cell has something in it. This works for two or three cells, such as first, middle and last names. For a long column it becomes hard to read and easy to break, which is exactly the problem TEXTJOIN solves. If your files must open in old versions, keep lists short or join them in a helper column, one row at a time.
Common TEXTJOIN problems#
Most TEXTJOIN problems come from version support, hidden characters or numbers. Check these:
- #NAME? Your Excel is older than 2019, so it doesn't know TEXTJOIN. Use
&or CONCATENATE instead. The comparison of & and CONCATENATE shows both. - Extra delimiters. The second argument is FALSE, or some cells hold spaces. Use TRUE and TRIM.
- Dates show as numbers. TEXTJOIN joins a date's serial number. Wrap it:
TEXT(B2,"d mmm yyyy"). - #VALUE! The result is longer than 32,767 characters, the most one cell can hold.
- Zeros appear. A 0 isn't empty. If a formula shows 0 for "nothing", change it to return
""instead.
Practise it#
TEXTJOIN with TRUE is one of the quickest wins in Excel, and it's easy to remember once you've typed it a few times. Practise joining text with &, CONCAT and TEXTJOIN in a live spreadsheet: you write the formula and it checks your answer instantly. The TEXTJOIN function guide is a handy syntax reference, and the guide to combining text from several cells covers the other joining methods.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Join the skills in A2:A7 into one line separated by a comma and a space, skipping the empty cells. Click C2 and use TEXTJOIN with TRUE as the second argument.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Skill | Skill list | ||
| 2 | Excel | |||
| 3 | ||||
| 4 | SQL | |||
| 5 | Power BI | |||
| 6 | ||||
| 7 | Python | |||
| 8 | ||||
| 9 | ||||
| 10 |
Tip: The delimiter comes first in quotes (a comma and a space), then TRUE, then the range.
Practise this in a lesson
Frequently asked questions
How do I make TEXTJOIN ignore blank cells?
Set the second argument to TRUE, as in =TEXTJOIN(", ",TRUE,A2:A10). Empty cells, and cells where a formula returns "", are then skipped.
Why does TEXTJOIN still show extra commas?
Either the second argument is FALSE, or the cells that look empty contain a space or other invisible character. Use =TEXTJOIN(", ",TRUE,TRIM(A2:A10)) in Microsoft 365 to turn space-only cells into empty text first.
What is the difference between TEXTJOIN and CONCAT?
TEXTJOIN puts a delimiter between items and can skip empty cells. CONCAT just joins everything with nothing in between, so you must add separators yourself.
How do I join cells based on a condition?
Put IF inside TEXTJOIN: =TEXTJOIN(", ",TRUE,IF(B2:B8="Yes",A2:A8,"")). In Excel 2021 or Microsoft 365, FILTER also works: =TEXTJOIN(", ",TRUE,FILTER(A2:A8,B2:B8="Yes")).
Is TEXTJOIN available in Excel 2016?
No. TEXTJOIN arrived in Excel 2019 and Microsoft 365. In Excel 2016 you need & or CONCATENATE, and you have to handle empty cells yourself.