Google Sheets REGEXSPLIT: How to Split Text

How-to basics · Updated November 23, 2026

Use the REGEXSPLIT function in Google Sheets to split text into multiple cells based on a regular expression pattern. The basic syntax is =REGEXSPLIT(text, regular_expression), which returns the separated pieces across adjacent columns. For example, =REGEXSPLIT("apple,banana,cherry", ",") puts “apple” in the formula cell, “banana” in the next cell, and “cherry” in the one after that.

What REGEXSPLIT Does (and Doesn’t Do)

REGEXSPLIT is one of three regex functions in Google Sheets, alongside REGEXEXTRACT and REGEXREPLACE. It divides a single text string into an array of substrings wherever the pattern matches. Unlike the simpler SPLIT function, which only splits on literal characters, REGEXSPLIT understands patterns like digits, word boundaries, or variable-length separators.

Key behavior to know:

  • It returns a horizontal array by default, spilling into columns to the right.
  • If the pattern matches at the very start or end of the text, the result includes an empty string at that edge.
  • Consecutive matches produce empty strings between them. For example, splitting “a,,b” on a comma gives “a”, “”, “b”.
  • The function is case-sensitive unless you use the (?i) flag at the start of the pattern.

How to Use REGEXSPLIT in a Real Sheet

Suppose you have a column of full names in A2:A10, formatted as “Last, First”. To split them into two columns, put this in B2:

=REGEXSPLIT(A2, ", ")

This splits on a comma followed by a space. Drag the formula down, and each row gets “Last” in B and “First” in C. If some cells have no space after the comma, use a pattern that allows optional whitespace: =REGEXSPLIT(A2, ",\\s*"). The \\s* means zero or more spaces, so it handles both “Doe, John” and “Doe,John”.

Another common case: extracting numbers from mixed text. With “Order 12345 shipped” in A2, use =REGEXSPLIT(A2, "[0-9]+"). This splits the text wherever a run of digits occurs, giving “Order ” and ” shipped” (note the spaces). To also remove the spaces, you’d need a more complex pattern or a follow-up TRIM.

Choosing Between SPLIT and REGEXSPLIT

SPLIT is simpler and faster for fixed delimiters like commas, tabs, or semicolons. Use SPLIT when your separator is a single character or a short exact string. REGEXSPLIT is worth the extra complexity when:

  • Your separator varies (e.g., commas, semicolons, or pipes).
  • You need to split on a pattern like “any digit” or “any whitespace”.
  • You want to split on a word boundary or a pattern with optional parts.

For a variable separator like commas or semicolons, use =REGEXSPLIT(A2, "[,;]"). The square brackets define a character class, so it matches either a comma or a semicolon. If you also want to skip spaces after those separators, use "[,;]\\s*".

Common Errors and How to Fix Them

The most frequent error is #N/A. This appears when the pattern doesn’t match the text at all. For example, =REGEXSPLIT("hello", "[0-9]") returns #N/A because there are no digits. To avoid this, wrap the formula in IFERROR: =IFERROR(REGEXSPLIT(A2, ","), A2) which returns the original text if no split occurs.

Another issue is the pattern being interpreted incorrectly. In Google Sheets regex, a backslash is an escape character. To match a literal period, you need "\\." (two backslashes in the formula because the string itself processes one). For example, to split a filename “report.2024.xlsx” on the dots, use =REGEXSPLIT(A2, "\\."). If you forget the double backslash, "." matches any character, splitting every character into its own cell.

A third issue: when the pattern matches zero-length positions. Patterns like "(?=,)" (lookahead) or "\\b" (word boundary) can create empty strings or unexpected splits. Stick to consuming patterns (ones that actually eat characters) unless you fully understand lookaheads.

Splitting into Rows Instead of Columns

By default, REGEXSPLIT spills horizontally. To split into rows, wrap it with TRANSPOSE. For example, to put each item on its own row: =TRANSPOSE(REGEXSPLIT(A2, ",")). This is useful when you later need to filter or sort the pieces vertically.

If you’re splitting a range of cells (e.g., A2:A10) and want all results stacked, you can combine with FLATTEN: =FLATTEN(TRANSPOSE(REGEXSPLIT(A2:A10, ","))). This first splits each cell horizontally, transposes to vertical, then flattens all rows into one column. Note that this requires the array to be the same size per cell; if some cells have more pieces than others, you’ll get #N/A errors. Use IFERROR inside to handle that.

Using REGEXSPLIT with Other Functions

REGEXSPLIT is often used with ARRAYFORMULA or LAMBDA to process multiple cells at once. For a column of data, you can write =ARRAYFORMULA(REGEXSPLIT(A2:A10, ",")), which will spill results for each row, but the output is a 2D array where each row’s pieces go to the right. This works only if every cell has the same number of pieces, otherwise the shorter rows produce #N/A in the extra columns.

To count the number of pieces, use =COUNTA(REGEXSPLIT(A2, ",")). To extract the second piece specifically, use INDEX: =INDEX(REGEXSPLIT(A2, ","), 1, 2). The first argument is the row (1 for a single-cell split), the second is the column position. This is a clean alternative to REGEXEXTRACT when you know the position but not the exact pattern.

Frequently Asked Questions

Why does REGEXSPLIT return #N/A when there’s no match? That’s the designed behavior. Unlike SPLIT which returns the whole string, REGEXSPLIT expects at least one match. Wrap it in IFERROR to return something else, like the original text or an empty string.

How do I split on multiple different delimiters at once? Use a character class in brackets. For example, =REGEXSPLIT(A2, "[,;|]") splits on commas, semicolons, or pipe characters. To include spaces after those, add \\s* after the class: "[,;|]\\s*".

Does REGEXSPLIT work on Mac or in the mobile app? Yes, it’s a standard Google Sheets function available in the web browser, Android, and iOS apps. The syntax is identical. However, the mobile apps may not show the spill correctly if columns are hidden; expand them to see all results.

Can I split a cell into rows without TRANSPOSE? Not directly. REGEXSPLIT always returns a horizontal array. TRANSPOSE is the standard way to flip it. Alternatively, you can use SPLIT with a different delimiter, but for regex patterns, TRANSPOSE is required.

What’s the difference between REGEXSPLIT and REGEXEXTRACT? REGEXSPLIT divides the text into parts, removing the matched separators. REGEXEXTRACT pulls out the matching portion itself. For example, from “Price: $25”, REGEXSPLIT on “\\$” gives “Price: ” and “25”, while REGEXEXTRACT with “\\$[0-9]+” gives “$25”. Use whichever matches your goal.

Is there a limit to how many pieces REGEXSPLIT can return? No hard limit, but Google Sheets has a 50,000-character cell limit. If your text is near that, splitting could produce many columns. Also, the number of columns in a sheet is limited to 18,278 (column ZZZ), so extremely long splits will overflow into errors. For such cases, consider splitting into rows instead.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.