Sub topic 1
Text, Delimiters, and What These Functions Do
SPLIT, JOIN, and REGEXEXTRACT are Google Sheets functions for working with text. SPLIT breaks one cell into pieces, JOIN combines pieces into one string, and REGEXEXTRACT pulls out a pattern. This chapter covers the first part: how text and delimiters work, and how SPLIT spreads pieces across cells.
Prerequisites
This chapter assumes you can:
- Enter formulas and refer to cells and ranges, such as
A2orA2:A10. - Write text values in double quotes inside a formula.
- Read a function's arguments, the values inside the parentheses separated by commas.
Text and delimiters
A delimiter is a character or string that marks where one piece of text ends and the next begins. Commas, semicolons, and spaces are common delimiters. SPLIT uses the delimiter you give it to cut text apart.
Splitting text into columns with SPLIT
The basic form is SPLIT(text, delimiter). The formula below splits the text in A2 at each comma and places each piece in its own cell, moving right from the formula cell.
=SPLIT(A2, ",")> Note: The formula spills its results into the cells to the right. Those cells must be empty, or the formula returns a "#REF!" error.
Multiple delimiters, multi-character delimiters, and empty pieces
SPLIT accepts optional arguments: SPLIT(text, delimiter, split_by_each, remove_empty_text). When split_by_each is TRUE, which is the default, each character in the delimiter string acts as its own delimiter. Setting it to FALSE treats the whole string as one delimiter.
=SPLIT(A2, ",;", TRUE, TRUE)
=SPLIT(A2, ", ", FALSE)The first formula splits at either a comma or a semicolon. The second splits only at the exact two-character sequence comma followed by space. When remove_empty_text is TRUE, the default, empty pieces are dropped.
Splitting a whole column and turning columns into rows
Wrap SPLIT in ARRAYFORMULA to process a whole range at once. TRANSPOSE then flips a row of results into a column.
=ARRAYFORMULA(SPLIT(A2:A10, ","))
=TRANSPOSE(SPLIT(A2, ","))Exercise
Exercise
Cell A2 contains "red;blue, green". Which formula returns three pieces, "red", "blue", and "green", with no empty pieces?
Show answer
=SPLIT(A2, ",;", TRUE, TRUE) or, equivalently, =SPLIT(A2, ",;")