The TEXTSPLIT function splits text values into parts and places each one into a different cell. A part of a text value lies between characters which delimit its boundaries. Cells populated by TEXTSPLIT can span multiple rows and columns, form a rectangular grid, and with the exception of padded cells will always contain text values. For example, if TEXTSPLIT were to operate on the text value “x,y,z” and treat comma (,) as a delimiter then 3 parts would be produced: “x“, “y“, and “z“.
Invocations of the TEXTSPLIT function take the form:
Consider a cell located on row 1 & column 1 of a worksheet containing the formula:
=TEXTSPLIT("a=1,b=2,c","=",",")
The formula operates on the text value “a=1,b=2,c” and designates the equals sign (=) as a column delimiter and comma (,) as a row delimiter. TEXTSPLIT reads the text value from left to right and designates sequences of characters bounded by delimiters as parts. TEXTSPLIT then uses the delimiter on the left-hand side of a part to decide which cell to place it in. TEXTSPLIT splits “a=1,b=2,c” into parts by performing the 6 steps illustrated below:
A column delimiter is a sequence of 1 or more characters whose presence marks the boundary between 2 parts of a text value. For example, in the text value “a|b”, the bar character (|) marks the boundary between “a” and “b”. TEXTSPLIT places a part of a text value appearing to the right of a column delimiter in the cell to the right of the preceding part. Column delimiters can be defined in one of two ways:
Type
Description
Single delimiter
1 or more characters defining the boundary between parts.
Multiple delimiters
If more than 1 column delimiter exists in a text value, they can be passed to the column_delimiter argument in an array constant. For example, {“,” , “|”} defines both the comma (,) and bar (|) characters as column delimiters.
row_delimiter
Optional
A row delimiter is a sequence of 1 or more characters whose presence marks the boundary between 2 parts of a text value. For example, in the text value “a|b”, the bar character (|) marks the boundary between “a” and “b”. A part of a text value appearing to the right of a row delimiter is placed in the row below the one containing the preceding part, and underneath the cell containing the formula cell referencing TEXTSPLIT. Row delimiters can be defined in one of two ways:
Type
Description
Single delimiter
1 or more characters defining the boundary between parts.
Multiple delimiters
If more than 1 row delimiter exists in a text value, they can be passed to the row_delimiter argument in an array constant. For example, {“,” , “|”} defines both the comma (,) and bar (|) characters as row delimiters.
ignore_empty
Optional. Defaults to FALSE if omitted.
The absence of a value between 2 delimiters represents a missing part. The ignore_empty argument determines how TEXTSPLIT manages these situations. It can assume one of two values:
Value
Description
TRUE
TEXTSPLIT does not create an empty cell to represent a missing part. Its behaviour differs based on the types of delimiters bounding a missing part. See example 3.
FALSE
TEXTSPLIT creates an empty cell to represent a missing part. Its behaviour differs based on the types of delimiters bounding a missing part. See example 3.
match_mode
Optional. Defaults to 0 if omitted.
Determines if TEXTSPLIT performs a case-sensitive match between (1) values passed to the row_delimiter & column_delimiter arguments and (2) the value passed to the text argument.
Value
Description
0
Case-sensitive match.
1
Case insensitive.
pad_with
Optional. Defaults to #N/A if omitted.
In some situations, cells which are not the recipient of a part derived from the text argument must be co-opted and populated with a value by TEXTSPLIT so its output can form a rectangular grid. The value supplied to the pad_with argument can be of type error, number, text or logical and is the value placed into co-opted cells. Values in co-opted cells are of the same type as the value supplied to the pad_with argument.