Separating Text in Excel
Texts in Excel can appear in different ways. Maybe there is a text which is joined by some kind of symbol or the text is like a first name and the last name.
There will be some point in our life where we will want those texts separated. The problem statement is explained above that we will come towards some sort of data where we need to separate those texts from one to another. But how do we separate those texts from one another? There is one very basic way to do it copy the desired text in each desired respective cell. Or, we can use some pre-given excel tools to do so.
How to Separate Text in Excel?
There are two methods to separate Texts in Excel:
- Using “Text to Columns in Excel“: which further has its own two bifurcations:
- Delimited: This feature splits the text which is being joined by characters, Commas, Tabs, Spaces, Semicolon or any other character such as a hyphen (-).
- Fixed Width: This feature splits the text which is being joined with spaces with some certain width.
- Using Excel Formulas: We can use formulas like the Len in excel to calculate the length of the string and separate the values by knowing the position of the characters.
Let us learn these methods using examples.
Example #1 – Delimiter Method to Separate Text
First things first, where do we find this feature text to columns in excel. It is under data Tab in the Data Tools section.
Consider the following data,
We want to separate the first name and the last name and have the contents of the last name in the B column.
#1 – To do this select the column containing the data i.e. A column.
#2 – Under Data Tab in the Data tools section Click on Text To Columns.
#3 – A dialog box appears for text to columns wizard.
#4 – As we are going to use the delimiter method first, Select the delimited option and click on next and another dialog box appears.
#5 – For the current data our texts are separated in excel by spaces so select Space option as a delimiter ( By default excel selects Tab as a delimiter). Click on Next.
#6 – We can see that our data preview that our texts are separated with first and last name. Click on Finish to see the result.
#7 – We have successfully separated our excel text by using text to column delimiter method.
4.9 (1,353 ratings) 35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
Example #2 – Using Fixed Width Method to Separate Text
We already know where the option of text to the column is in Excel. It is in the Data Tab under the data tools section.
Now we consider the following data,
There is a survey company which is conducting a survey for the feedback of a restaurant. The users give their feedback as Good or Bad but every response is saved by a timestamp which means with every response time is recorded, specific Data and time in Hours and minutes.
I need to separate the Date with the time in the data. Below is the data,
Step #1 – We do need to separate the contents of column A but there is data is in column B so we need to insert another column between column A and column B. To do that, Select Column B and press CTRL + +.
It adds another column between both the columns and shifts the data from previous column B to column C.
Step #2 – Now select the data in Column A, and click on Text to the column under Data Tab in the Data Tools section.
A dialog box appears for text to columns wizard.
Step #3 – This time we are using fixed width method so make sure that the fixed method option is selected and click on next another Text to Column Wizard dialog box appears.
Step #4 – In the data preview, we can see that the data is being separated into three parts which are Data Time and the meridian which is AM and PM.
We need only data and time so hover the mouse around the second line and double click on it and it disappears.
Step #5 – Now click on next, another Text to Column Wizard dialog box appears. There you need to click on the Finish button.
Now, the data is separated with Date in one column and time in another.
Step #6 – Currently, the formatting of the data in column B is not correct so we need to correct it. Select the contents on column B and in the Home tab under the numbers section the default selection is custom we need to change it to time.
Step #7 – Now we have successfully separated our excel data using Text to Columns Fixed Width Method.
Example #3 – Using Formulas for Separating Text
We can also use excel formulas to separate the text and numbers which is joined together. Of course, we can remove that data by using Text to columns but for complex situations, we use formulas for this.
Let us consider the following Data:
We have products in column A with their respective product codes. We need product in one column and product code in another. We want to use formulas to do this.
Step #1- To this, we need to first count the number of digits and separate that much number from the character.
Step #2- We need Product Name in B Column and Product Code in C column.
Step #3- First, we will separate the digits so that then we can separate the text in excel from the data. In C2 write the following excel formula to separate text
We use right to function as we know the numbers are in the right.
Step #4- Now in Cell B2 write the following Formula,
Step #5- Press Enter and we have successfully separated our data from Product Name and code by using Len function.
Step #6- Now drag the respective formulas to cell B6 and cell C6 Respectively.
Things to Remember in Separating Text in Excel (text to column & formula)
- If we are using Text to Columns Method always make sure that we have an additional column so that the data in any column doesn’t get replaced.
- If we are separating Texts in excel by using excel formulas we need to make sure of the positioning of the characters.
This has been a guide to Separate Text in Excel. Here we discuss how to separate text in excel using two methods 1) “Text to Column” (Delimited & Fixed Width) and 2) using Excel Formulas along with practical examples and downloadable template. You may learn more about excel from the following articles –