Google Sheets has a couple of effective spreadsheet tools that allow you to split a string of text into an array of individual elements. Knowing how to perform this action can be beneficial in the organization and analysis of data in Google Sheets. In this article, we will guide you on how to split a string into an array in Google Sheets.
The above screenshot is an overview of the article, representing how we can split string into array in Google Sheets.
A Sample of Practice Spreadsheet
You can download the spreadsheet and practice the techniques by working on it.
3 Easy Methods to Split String into Array in Google Sheets
Method 1: Using Split Text to Columns Feature
Splitting text or string data into an array or separate parts can be done quickly and easily by using the Split text to columns feature of Google Sheets.
To accomplish this task, consider using the following dataset that contains the Employee Names of a company. We will split these names into First Name, and Last Name using the built-in Split text to columns feature in Google Sheets.
- First, select the Employee Name cell range which you want to split. We select the range B5:B14 in our example and, go to Menu bar > Data > Split text to columns.
- Afterward, select the appropriate separator in the Separator dialog box. In our example, the names are structured as “First Name (Space) Last Name” so we select Space as the separator to split the names.
- Finally, you will see that the names are split into two columns. The results are always presented in the adjacent cells.
- How to Split Cell by Comma in Google Sheets (2 Easy Methods)
- [Solved!] Split Text to Columns Is Not Working in Google Sheets
- How to Split Address in Google Sheets (3 Easy Methods)
- Split a Cell in Google Sheets (9 Quick Methods)
Method 2: Applying SPLIT Function with ARRAYFORMULA
The SPLIT function allows you to split a string into an array using a specific delimiter. The ARRAYFORMULA function allows you to apply a function to a range of cells.
We use the same dataset we used for the previous method. We will use the SPLIT function together with the ARRAYFORMULA function to split these Employee Names into First Name, and Last Name.
- First, go to the first cell of the table where you want to split the names. We go to cell C5 in our example.
- Then, insert the ARRAYFORMULA function.
- Next, insert the SPLIT function.
- After that, type the cell reference of the range of Names that you want to split. We type B5:B14 as the Names are in range B5:B14 in our example.
- Now, type the delimiter by which you want to split the names. In our example, we structure the Employee Names as “First Name (Space) Last Name” so we insert Space (” “) inside a quotation as the delimiter.
- Then, close the parenthesis to complete the formula. This is what the final formula looks like:
- Finally, press ENTER to split the names.
Method 3: Applying SPLIT with REGEXREPLACE and CHAR Functions
We can use the SPLIT, REGEXREPLACE, and the CHAR functions together to break a word into its individual letters and characters. Breaking a word down into its individual characters may seem straightforward, however, it can be a challenging task when trying to automate this process using an application such as Google Sheets.
We use the following dataset for this method.
- First, select cell D5.
- Then, type the following formula:
The CHAR(127) works as a delimiter. In ASCII it is known as the Delete Character. It is virtually invisible and highly likely not to show up in any regular texts or strings.
The inner REGEXREPLACE function replaces every character of the word with itself and combines it with a special character CHAR(127). A regular expression flag (?s) is also included that allows the dot (.) to match characters and new lines if there are multiple lines in the reference cell.
The outer REGEXREPLACE function handles any single quotes that might appear in the reference text. It replaces single quotes (‘) with double single quotes (‘’).
The SPLIT function here uses CHAR(127) as a delimiter to separate the characters of the word here.
- Finally, press ENTER to get the required result.
In this article, we have demonstrated methods to split a string into array in Google Sheets. Practice the techniques shown in order to fully grasp the concept. The goal of the article is to provide helpful information and guide you in your task.
Additionally, consider looking into other articles available on OfficeWheel to expand your understanding and skill in using Google Sheets.