To split a string by spaces in Google Sheets, use the SPLIT function: =SPLIT(A1, " "). This divides the text in cell A1 into separate cells at each space. For more control, use SPLIT with TRIM to remove extra spaces, or the REGEXEXTRACT function for patterns.
Why You Need to Split Text by Spaces
Spreadsheets often contain full names, addresses, or product descriptions in a single cell, but you need the pieces separately for sorting, filtering, or merging with other data. For example, a column with “John Smith” might need first and last names in separate columns for a mail merge. Splitting by space is the simplest way to break text into its component parts, and Google Sheets offers several methods depending on how clean your data is.
Method 1: The SPLIT Function (Simplest)
The SPLIT function is the most direct tool. It takes two arguments: the text (or cell reference) and the delimiter (the character to split on). For a space, use a space inside quotes.
- Syntax:
=SPLIT(text, delimiter) - Example: If cell A1 contains “apple orange banana”, then
=SPLIT(A1, " ")returns three cells: “apple”, “orange”, “banana”.
This works perfectly for simple, single spaces. However, if your text has multiple consecutive spaces (e.g., “apple orange”), SPLIT will create an empty cell between them. To avoid that, wrap the text in TRIM first: =SPLIT(TRIM(A1), " "). This removes leading, trailing, and extra internal spaces before splitting.
Method 2: Using SPLIT with Other Delimiters
Sometimes “space” isn’t the only separator. For instance, a cell might contain “John Smith, 123 Main St” where you want to split by both space and comma. You can combine delimiters in the SPLIT function by putting them in square brackets: =SPLIT(A1, "[ ,]"). This treats both a space and a comma as separators. This is especially useful for addresses or lists. Note that the delimiter is treated as a regular expression, so special characters like periods or parentheses need escaping with a backslash (e.g., =SPLIT(A1, "\.") to split on periods).
Method 3: Using REGEXEXTRACT for Complex Patterns
If you need to extract only specific parts of a string, like the first word or the last name, REGEXEXTRACT is more precise. It uses regular expressions to pull out matching text. For example, to get the first word from A1: =REGEXEXTRACT(A1, "^\\S+"). This matches from the start of the string up to the first space. To get the last word: =REGEXEXTRACT(A1, "\\S+$"). These are useful when you don’t want to split the whole string but just grab one piece.
How to Split Using the Menu (Split Text to Columns)
If you prefer a menu-based approach, Google Sheets has a built-in feature called “Split text to columns.” This is ideal for one-time operations on a column of data.
- Select the column or range of cells containing the text you want to split.
- Go to Data > Split text to columns.
- A small menu appears at the bottom of the selected range. Choose “Space” from the dropdown (or “Custom” to type your own delimiter).
- The data splits into adjacent columns immediately.
This method overwrites the original data with the split parts, so it’s best to work on a copy or ensure you don’t need the original intact. Unlike the SPLIT function, this is a one-time action—if you change the original text, the split columns won’t update automatically.
Common Problems and How to Fix Them
Here are typical issues you might encounter:
- Extra spaces: Use
TRIMbefore splitting, or use the “Split text to columns” menu and then select “Trim” from the same dropdown (it appears after you choose a delimiter). - Empty cells: If your text has multiple spaces,
SPLITcreates empty cells. Use=SPLIT(TRIM(A1), " ")to eliminate them. - Data overwritten: When using “Split text to columns,” the original column is replaced. To keep the original, copy the column to a new location first.
- Formula errors: If you see #VALUE!, check that the delimiter is in quotes. For spaces, it’s
" "(a space inside quotes).
Comparing SPLIT vs. Split Text to Columns
Both methods have their place. The SPLIT function is dynamic—it updates when the source cell changes. This is great for ongoing data entry. The menu-based “Split text to columns” is static—it creates plain text results that don’t change. If you need a permanent snapshot of the split data, use the menu. If you need a formula that recalculates, use SPLIT. Also, SPLIT can be nested inside other functions, like INDEX to get a specific part: =INDEX(SPLIT(A1, " "), 1, 2) returns the second word. This is impossible with the menu method.
Frequently Asked Questions
Can I split by space and comma at the same time?
Yes, use =SPLIT(A1, "[ ,]") to split on both space and comma. The square brackets define a set of characters to treat as delimiters.
How do I split a string into separate rows instead of columns?
By default, SPLIT puts results in columns. To put them in rows, use =TRANSPOSE(SPLIT(A1, " ")). This flips the output from a row to a column.
Why does my SPLIT function return an empty cell?
This usually happens when there are consecutive spaces. For example, “apple orange” has two spaces between them. SPLIT will create an empty cell for the extra space. Use =SPLIT(TRIM(A1), " ") to remove extra spaces first.
Is there a way to split by space but keep the original cell?
Yes, the SPLIT function does not modify the original cell—it only outputs the split parts into new cells. The original text remains unchanged. The menu method, however, overwrites the original, so use the function if you need to preserve it.
What if my text has tabs or newlines instead of spaces?
Use the appropriate delimiter: for a tab, use =SPLIT(A1, CHAR(9)); for a newline, use =SPLIT(A1, CHAR(10)). You can also use the menu method and select “Custom” and paste the actual tab or newline character.
Can I split by space in Excel the same way?
Excel does not have a SPLIT function. Instead, use the “Text to Columns” wizard (Data > Text to Columns) or use a combination of LEFT, RIGHT, and FIND. In Excel 365, you can use TEXTSPLIT which works similarly to SPLIT.
Related
- Google Dividend Yield: Current Rate & How It Works
- Balance Sheet T Format: Layout & How to Read It
- Balance the US Budget? How It Works and What It Takes
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Subscript vs Superscript in Excel: What’s the Difference?In Excel, subscript places selected characters below the text baseline, while superscript places them above it. To apply…
- How to Add Turabian Footnotes in Word, Step by StepTo add a Turabian footnote in Word, place your cursor after the sentence punctuation, choose References > Insert…
- How to Freeze Panes in Excel: Keep Rows and Columns VisibleTo keep headings or identifying columns visible while you scroll in Excel for Microsoft 365 on Windows, select…
- How to Insert a Checkbox in Microsoft Word: Two WaysTo insert a checkbox in Microsoft Word, use Developer > Check Box Content Control for a box readers…
- How to Add a Timestamp in Google Sheets AutomaticallyTo add a fixed timestamp in Google Sheets, select a cell and press Ctrl+Alt+Shift+; on Windows or ChromeOS;…
- Create Circle Labels in Word: A Step-by-Step GuideTo create circle labels in Microsoft Word, start with a template that matches your label sheet, add your…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.