Split a text string with a delimiter
=TEXTSPLIT(text, col_delimiter, [row_delimiter], [ignore_empty], [match_mode], [pad_with])
| Parameter | Description |
|---|---|
text |
The text string to split. |
col_delimiter |
The character(s) to delimit columns. |
row_delimiter |
[optional] The character(s) to delimit rows. |
ignore_empty |
[optional] Ignore empty values. TRUE = ignore, FALSE = preserve. Default is FALSE. |
match_mode |
[optional] Case-sensitivity. 0 = enabled, 1 = disabled. Default is 0. |
pad_with |
[optional] Value to pad missing values in 2d arrays. |
TEXTSPLIT can split a text string into columns or rows. To use TEXTSPLIT, you will need to provide the text to split and a delimiter. You can either p
=TEXTSPLIT("red-blue-green","-") // returns {"red","blue","green"}
Note that the column delimiter is provided as a hyphen ("-). If we move the hyphen ("-") to the row delimiter position, the TEXTSPLIT function will re
=TEXTSPLIT("red-blue-green",,"-") // returns {"red";"blue";"green"}
The first formula in cell D3 separates the three values into separate columns:
=TEXTSPLIT(B3,",") // returns {"Red","Blue","Green"}
The formula in cell D5 uses the same delimiter to split the text into separate rows:
=TEXTSPLIT(B3,,",") // returns {"Red";"Blue";"Green"}
If the provided delimiter is not found, TEXTSPLIT will return the original text unchanged. For example, if we use TEXTSPLIT on the text string "apple
=TEXTSPLIT("apple orange",".") // returns "apple orange"
The formula in cell D3 does not include a value for ignore_empty, so empty values will appear:
=TEXTSPLIT(B3,",") // empty values will appear