Sub topic 3
Multiple Delimiters, Multi-Character Delimiters, and Empty Pieces
Assume you can enter formulas, reference cells and ranges, and use basic functions such as TRIM and IFERROR. In this chapter, you will control how SPLIT treats delimiter characters and empty pieces.
How `SPLIT` interprets delimiters
A delimiter is the character or text that marks where one piece ends and the next begins. The syntax is:
=SPLIT(text, delimiter, [split_by_each], [remove_empty_text])The optional arguments control how the delimiter is interpreted:
| Argument | Meaning | Default |
|---|---|---|
| `split_by_each` | Treat each character in the delimiter as a separator | `TRUE` |
| `remove_empty_text` | Remove empty pieces between adjacent separators | `TRUE` |
Suppose A2 contains:
red,blue,greenThis formula places the three values in adjacent cells:
=SPLIT(A2, ",")The result spills across the row. A spilled result is a group of values that a formula places into neighboring cells automatically.
Using several one-character delimiters
With the default split_by_each value of TRUE, every character in the delimiter argument acts as a separator. The following formula splits at either a comma or a semicolon:
=SPLIT(A2, ",;", TRUE, TRUE)For example, if A2 contains red,blue;green, the result is red, blue, and green.
This behavior is useful when a column contains inconsistent separators. The delimiter string ",;" does not mean “comma followed by semicolon.” It means “comma or semicolon.”
SPLIT treats delimiter characters as plain text. It does not interpret them as regular expression patterns. For example, a period in the delimiter argument means a literal period.
Treating a multi-character delimiter as one unit
Sometimes a separator contains more than one character. Suppose A2 contains:
red, blue, greenIf you use the default setting with ", " as the delimiter, Sheets treats the comma and space as two separate delimiters:
=SPLIT(A2, ", ")That may still produce the expected pieces when the input is consistent. However, the distinction matters when either character appears by itself.
Set split_by_each to FALSE to require the complete delimiter string:
=SPLIT(A2, ", ", FALSE)Now only the exact two-character sequence comma-plus-space separates values. A standalone comma or space does not split the text.
Keeping or removing empty pieces
Adjacent delimiters represent an empty piece. For example, this text has no value between the comma and semicolon:
red,,blue;green;To keep empty pieces, set remove_empty_text to FALSE:
=SPLIT(A2, ",;", TRUE, FALSE)The result includes an empty cell between red and blue. It also includes an empty piece after the final semicolon.
To remove those empty pieces, use TRUE:
=SPLIT(A2, ",;", TRUE, TRUE)Removing empty pieces is usually better for a list of tags. Keeping them can help you detect missing fields in a structured record.
A practical cleanup pattern
If list values may have spaces around them, split first and trim each resulting value:
=ARRAYFORMULA(TRIM(SPLIT(A2, ",;", TRUE, TRUE)))ARRAYFORMULA applies TRIM to every value returned by SPLIT. This removes leading and trailing spaces from each piece.
Exercise
A2 contains one||two|three. Which formula splits at the exact delimiter || while preserving the single pipe inside three if one appears?
Show answer
Use =SPLIT(A2, "||", FALSE, TRUE). The FALSE argument makes || one exact delimiter.