Sub topic 2
Splitting text into columns with SPLIT
This chapter assumes you can enter formulas, reference cells and ranges, and know that text in a formula goes inside double quotes. It also assumes you have used a function that takes arguments, such as TRIM. Here you will learn how SPLIT works, where its results land, and the mistakes that make it fail.
What SPLIT does
SPLIT takes one piece of text and cuts it at a delimiter. A delimiter is a character that marks the boundary between pieces, such as a comma in red,green,blue. SPLIT writes each piece into its own cell, moving to the right.
The syntax has four arguments, and only the first two are required:
=SPLIT(text, delimiter, [split_by_each], [remove_empty_text])| Argument | Required | Meaning |
|---|---|---|
| `text` | Yes | The text to cut. Usually a cell reference such as `A2`, or a string in quotes. |
| `delimiter` | Yes | The character or characters to cut at, written as a string in quotes. |
| `split_by_each` | No | Whether each character in the delimiter counts as its own delimiter. Default is `TRUE`. |
| `remove_empty_text` | No | Whether empty pieces are dropped. Default is `TRUE`. |
The next chapter covers the last two arguments in detail. This chapter uses only the first two.
A first example
Suppose column A holds comma-separated tags:
| Row | A |
|---|---|
| 1 | tags |
| 2 | red,green,blue |
| 3 | small,large |
Put this formula in B2:
=SPLIT(A2, ",")B2 shows red, C2 shows green, and D2 shows blue. You entered one formula, and it filled three cells.
The delimiter is not part of any piece. The commas are consumed by the split and do not appear in the output.
How the result spills
A formula that returns several values writes them into neighboring cells. This is called a spill. The cell holding the formula is the anchor, and the result extends right from it, one cell per piece.
Three rules follow from this:
- Only the anchor cell contains the formula. Click C2 and the formula bar is empty. Sheets shows a faded copy of the formula result there, and you cannot edit it directly.
- The size of the result depends on the data.
A2yields three cells andA3yields two. If you later edit A2 to contain five tags, the spill grows to five cells without you touching the formula. - Deleting the anchor formula clears the whole spill. Typing a value into a spilled cell does not edit it. It blocks the spill, which is covered next.
When the spill is blocked
A spill needs empty cells to land in. If any cell in the path already holds data, SPLIT cannot write its result, and the anchor shows #REF!. Hovering over the error gives a message that the array result was not expanded because it would overwrite data in a named cell.
Say you type note in D2 and then enter =SPLIT(A2, ",") in B2. The result needs B2, C2, and D2, and D2 is taken. The formula fails entirely. It does not fill B2 and C2 and stop. Clear D2, or move the formula to a row or column with space, and the result appears.
Because the result width depends on the data, a formula that works today can start failing when a new row has more pieces than the free space. Leave the columns to the right of a SPLIT formula empty. Put the formula in the last used column of the sheet if you can.
Choosing the delimiter
The delimiter can be any character that appears in the text. These are common ones:
| Data looks like | Delimiter argument | Column | Column | Column |
|---|---|---|---|---|
| `red,green,blue` | `","` | |||
| `red;green;blue` | `";"` | |||
| `red green blue` | `" "` | |||
| `red\ | green\ | blue` | `"\ | "` |
| `2026-11-27` | `"-"` | |||
| `[email protected]` | `"@"` |
A few details matter here:
- The delimiter is a string, so it must be in double quotes.
=SPLIT(A2, ,)and=SPLIT(A2, ,)with a bare comma are formula errors. - A space is a valid delimiter. Write it as
" ", with one space between the quotes. - If the delimiter does not appear in the text,
SPLITreturns the whole text in one cell. This is not an error. It means a row with no delimiter looks like a row that was never split, which is easy to miss when you scan a long column. - Matching is exact. A delimiter of
","does not match a full-width comma,or a semicolon, even though they look similar.
Here is a worked case. Column A holds dates written as 2026-11-27, and you want the year, month, and day in separate columns:
=SPLIT(A2, "-")The result is three cells: 2026, 11, and 27.
Pieces that look like numbers
SPLIT does not leave every piece as plain text. Sheets interprets each piece the way it would interpret something you typed in. A piece such as 27 becomes the number 27, and a piece that looks like a date may become a date value.
This has two consequences. First, a piece like 007 loses its leading zeros and becomes 7. Second, numbers can be used in arithmetic right away, so =SUM(B2:D2) works on split digits without a conversion step.
If you need to keep leading zeros, such as in ZIP codes or product codes, set the destination cells to a plain text format before the formula runs, or use a different approach from the later chapters. Formatting after the fact does not bring the zeros back.
Whitespace stays in the pieces
SPLIT cuts only at the delimiter. It does not trim anything. Take this text in A2:
Ada Lovelace, London, EnglandWith =SPLIT(A2, ",") the pieces are Ada Lovelace, London, and England. The second and third pieces begin with a space, because the space came after the comma and was not part of the delimiter.
You cannot see the problem on screen, but it shows up when you compare values. A lookup for London fails against London. A column sort and a count of unique values also treat the two as different.
There are two fixes. The first wraps the result in TRIM, which removes leading and trailing spaces. Because SPLIT returns several cells, TRIM needs ARRAYFORMULA to apply to all of them:
=ARRAYFORMULA(TRIM(SPLIT(A2, ",")))The second makes the delimiter include the space. That works only when the spacing is perfectly regular, and the next chapter explains the multi-character delimiter options that make it possible. In real data the spacing varies, so trimming is the safer habit.
Splitting text that is not in a cell
The text argument can be a literal string. This is useful for trying a delimiter out:
=SPLIT("one two three", " ")It also accepts the output of other functions, so you can split the result of a join, a lookup, or a text function. Anything that produces a single string can feed SPLIT.
What SPLIT does not accept, in its plain form, is a range of several cells as the text. A formula such as =SPLIT(A2:A10, ",") does not give you nine rows of results. To split a column in one formula you wrap the call in ARRAYFORMULA. The chapter on splitting whole columns covers that technique.
Working with the pieces afterward
The pieces are ordinary cell values, so other formulas can refer to them. Use the anchor cell and the cells to its right the same way as any other data:
=COUNTA(B2:Z2)counts how many pieces row 2 produced.=C2reads the second piece.=INDEX(SPLIT(A2, ","), 1, 2)reads the second piece without needing the spill cells to be free, becauseSPLITis evaluated inside the formula and not written to the sheet.
The last form is useful when you need only one piece. INDEX takes the array, a row number, and a column number. A split result is one row wide, so the row is always 1 and the column picks the piece. This avoids both the blocked-spill problem and the extra columns in your sheet.
A related idea is to take the last piece when the number of pieces varies. For a path like a/b/c/d, you can write:
=INDEX(SPLIT(A2, "/"), 1, COUNTA(SPLIT(A2, "/")))COUNTA counts the pieces, and that count is used as the column number to pick the final one.
Common errors with SPLIT
| Symptom | Likely cause | Fix |
|---|---|---|
| `#REF!` in the anchor cell | A cell to the right already contains data | Clear the cells in the path or move the formula |
| Whole text appears in one cell | The delimiter is not in the text, or looks the same but is a different character | Copy the actual character from the data into the delimiter |
| Pieces start with a space | Delimiter was a bare comma but the data has `, ` | Wrap in `ARRAYFORMULA(TRIM(...))` |
| Leading zeros are gone | Sheets read the piece as a number | Format the destination as plain text first |
| `#VALUE!` or only one row of output | The first argument is a multi-cell range | Use `ARRAYFORMULA` or reference one cell |
Exercise
Cell A2 contains north;south;east;west. Write a formula in B2 that puts each direction in its own cell. Then say what happens if B2's formula is entered while E2 already contains the word done, and how you would fix it.
Show answer
Use =SPLIT(A2, ";"). The result needs four cells (B2, C2, D2, E2). Because E2 already holds data, the spill is blocked and B2 shows #REF!, with no pieces written to C2 or D2 either. Clear E2 (or move the formula to a place with four free cells to its right) and all four directions appear.
Exercise
A2 contains Grace Hopper, Arlington, USA. You enter =SPLIT(A2, ",") and a lookup for Arlington on C2 fails. Why, and what single formula fixes the pieces?
Show answer
The delimiter was only the comma, so the space after each comma stays at the start of the piece. C2 holds Arlington, which does not equal Arlington. Use =ARRAYFORMULA(TRIM(SPLIT(A2, ","))) so each piece has its leading space removed.