TEXTJOIN
Combine values with a delimiter between them, optionally skipping empty ones.
Syntax
TEXTJOIN(delimiter, ignore_empty, text1, [text2], ...) | Argument | Required | Description |
|---|---|---|
delimiter | Required | What to put between the values. Given once, not repeated. |
ignore_empty | Required | TRUE to skip empty values, FALSE to keep their separators. |
text1 | Required | The first value to join. |
text2 | Optional | Further values. |
Examples
Every example below was executed against VisiGrid engine 0.35.0 — not
transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.
| Formula | Result | Notes |
|---|---|---|
=TEXTJOIN(", ",TRUE,"Ana","Bo","Cy") | Ana, Bo, Cy | |
=TEXTJOIN("-",TRUE,"a","","c") | a-c | Empty values skipped, and no double separator left behind. |
=TEXTJOIN("-",FALSE,"a","","c") | a--c | The same data with ignore_empty FALSE — the gap is preserved. |
The second argument is the whole point
ignore_empty decides what happens to gaps, and the two answers are genuinely
different jobs:
TRUEbuilds a readable list. Missing values vanish and you never getAna, , Cy.FALSEbuilds a record with positions. Every field keeps its slot, so the third value is always the third item even when the second is blank.
Use TRUE for anything a person reads and FALSE for anything a machine
parses. Choosing wrongly produces output that looks fine until a value is
missing.
Why it beats joining by hand
Building the same list with & means writing the separator between every pair,
and then handling the empties yourself:
=A1 & ", " & B1 & ", " & C1
If B1 is blank that gives Ana, , Cy. TEXTJOIN with TRUE gives
Ana, Cy, which is what anyone actually wanted.
Excel compatibility
Matches Excel, including both behaviours of ignore_empty.