Text formula page
Combine Cells Formula
Use TEXTJOIN when names, labels, or address pieces should combine with a separator.
Combine cells in Excel or Google Sheets.
The formula joins nonblank cells from A2:C2 with spaces.
Copy formulas
=TEXTJOIN(" ", TRUE, A2:C2)=TEXTJOIN(" ", TRUE, A2:C2)Excel and Google Sheets use the same TEXTJOIN syntax. TRUE skips empty cells, while FALSE preserves every cell position and can create repeated separators.
Example data
| Raw Text | Example Result |
|---|---|
| Maya Chen | Maya |
| SKU-1001-East | SKU |
| https://www.example.com/pricing | example.com |
| Acme North | Acme North |
The formula joins nonblank cells from A2:C2 with spaces.
How the formula works
- The first argument is the separator.
- TRUE skips blank cells.
- A2:C2 is the range to combine.
| Syntax piece | Role in the formula |
|---|---|
| " " | The separator inserted between included cell values. |
| TRUE | The ignore-empty setting that skips blank cells. |
| A2:C2 | The source range whose values are combined in order. |
Verified examples
=TEXTJOIN(" ", TRUE, A2:C2)Excel: Enter Maya in A2, Chen in B2, and leave C2 blank. Returns: Maya Chen
=TEXTJOIN(", ",TRUE,A2:C2)Google Sheets: Enter East, Widget, and 420 in A2:C2. Returns: East, Widget, 420
=TEXTJOIN(" ",FALSE,A2:C2)Excel: Enter Maya in A2, leave B2 blank, and enter Chen in C2. Returns: Maya Chen
Common errors and fixes
| Issue | Likely cause | Fix |
|---|---|---|
| The result has unwanted double separators | FALSE includes blank cells and therefore preserves their separator positions. | Use TRUE when blank cells should be skipped, or clean the source range first. |
| The combined text contains odd spacing | Source cells contain leading or trailing spaces that TEXTJOIN does not remove. | Apply TRIM to source values before combining when spacing is not meaningful. |
| The formula returns a length error | The combined result exceeds the spreadsheet cell character limit or the range is unnecessarily broad. | Narrow the source range or split the output across cells. |
When not to use this formula
- Do not use TEXTJOIN when the combined values must remain separately sortable or independently editable in the output.
Alternatives
| Alternative | When to use it |
|---|---|
| Remove Spaces Formula | Use when the main task is cleaning source spacing before combining values. |
| Split Text Formula | Use when a combined string needs to be separated into cells again. |
Related formulas
Official references
- TEXTJOIN function from Microsoft
FAQ
What does TRUE do in TEXTJOIN?
TRUE skips empty cells, so their separators are not added to the result.
Does TEXTJOIN clean source spacing?
No. It joins the values as supplied, so use TRIM when source cells contain unwanted spaces.