How to split cells in Excel: Text to Columns, Flash Fill and formulas
How do you split a cell in Excel? By using the Text to Columns feature, Flash Fill, formulas or Split Text tool. This tutorial outlines all the options to help you choose the technique best suited for your particular task.
Generally, you may need to divide cells in Excel in two cases. Most often, when you import data from some external source where all information is in one column while you want it in separate columns. Or, you may want to separate cells in an existing table for better filtering, sorting or a detailed analysis.
How to split cells in Excel using Text to Columns
The Text to Columns feature comes in really handy when you need to divide a single cell into two or more cells. It allows splitting text strings by a specified delimiter such as comma, semicolon or space as well as separating substrings of a fixed length. Let's see how each scenario works.
How to separate cells in Excel by delimiter
Suppose, you have a list of participants where a participant name, country and expected arrival date are all in the same column:
What we want is to separate data in one cell into several cells such as First Name, Last Name, Country, Arrival Date and Status. To have it done, perform the following steps:
- If you want to put the split cells in the middle of your table, start by inserting a new column(s) to avoid overwriting your existing data.
In this example, we have inserted 3 new columns like shown in the screenshot below:
If you don't have any data next to the column you want to separate, skip this step. - Select the cells you want to divide, navigate to the Data tab > Data Tools group, and click the Text to Columns button.
- In the first step of the Convert Text to Columns wizard, you choose how to split cells - by delimiter or width.
In our case, the cell contents are separated with spaces and commas, so we select Delimited, and click Next.
- In the next step, you specifythe delimiters and, optionally, text qualifier.
You can choose one or more predefined delimiters as well as type your own one in the Other box. In this example, we select Space and Comma:
Tips:- Treat consecutive delimiters as one. Be sure to select this option when your data may contain two or more delimiters in a row, e.g. when there are a few consecutive spaces between words or the data is separate by a comma and a space, like "Smith, John".
- Specifying the text qualifier. Use this option when some text is enclosed in single or double quotes, and you'd like such portions of text to be inseparable. For example, if you choose a comma (,) as the delimiter and a quotation mark (") as the text qualifier, then any words enclosed in double quotes, e.g. "California, USA", will be put into one cell as California, USA. If you select {none} as the text qualifier, then "California will be distributed into one cell (together with an opening quotation mark) and USA" into another (together with a closing mark).
- Data preview. Before you click the Next button, it stands to reason to scroll through the Data preview section to make sure Excel has split all cells contents right.
- Just two more things are left for you to do - choose the data format and specify where you want to paste split data:
- Data format. By default, the General format is set for all columns, which works well in most cases. In our example, we need the Data format for the arrival dates. To change the data format for a particular column, click on that column under Data preview to select it, and then choose one of the formats under Column data format (please see the screenshot below).
- Destination. To tell Excel where you want to output the separated data, click the Collapse Dialog icon
next to the Destination box and select the top-leftmost cell of the destination range, or type a cell reference directly in the box. Please be very careful with this option, and make sure there are enough empty columns right to the destinaton cell.
Notes:- If you do not want to import some column that appears in the data preview, select that column and check Do not import column (skip) radio button under Column data format.
- It is not possible to import the split data to another spreadsheet or workbook. If you attempt to do this, you will get the invalid destination error.
- Finally, click the Finish button and you are done! As shown in the below screenshot, Excel has perfectly split the contents of one cell into several cells:
How to split text of a fixed width
This section explains how to divide a cell in Excel based on the number of characters you specify. To make things easier to understand, please consider the following example.
Supposing, you have Product IDs and Product names in one column and you want to extract the IDs into a separate column:
Since all of the product IDs contain 9 characters, the Fixed width option fits perfectly for the job:
- Start the Convert Text to Columns wizard as explained in the above example. In the first step of the wizard, choose Fixed width and click Next.
- Set the width of each column by using the Data preview section. As shown in the screenshot below, a vertical line represents a column break, and to create a new break line, you simply click at the desired position (9 characters in our case):
To remove the break, double-click a line; to move a break in another position, simply drag the line with the mouse. - In the next step, choose the data format and destination for the split cells exactly as we did in the previous example, and click the Finish button to complete the separation.
How to separate cells Excel with Fill Flash
Begining with Excel 2013, you can benefit from the Flash Fill feature that can not only automatically populate cells with data, but also split cell contents.
Let's take a column of data from our first example and see how Excels' Flash Fill can help us split a cell in half:
- Insert a new column next to the column with the original data and type the desired part of the text in the first cell (participant name in this example).
- Type the text in a couple more cells. As soon as Excel senses a pattern, it will populate similar data into other cells automatically. In our case, it's taken 3 cells for Excel to figure out a pattern:
- If you are happy with what you see, press the Enter key, and all the names will be copied to a separate column at once.
How to split cell in Excel with formulas
Whatever diverse information your cells may contain, a formula to split a cell in Excel boils down to finding a position of the delimiter (comma, space, etc.) and extracting a substring before, after or in-between the delimiters. Generally, you'd use SEARCH or FIND functions to determine the delimiter's location and one of the Text functions (LEFT, RIGHT or MID) to get a substring.
For example, you'd use the following formulas to split data in cell A2 separated with a comma and space (please see the screenshot below):
To extract the name in B2:
=LEFT(A2, SEARCH(",",A2)-1)
To extract the country in C2:
=RIGHT(A2,LEN(A2)-SEARCH(",",A2)-1)
For the detailed explanation of the logic and more formula examples to divide cells in Excel, please check out the following resources:
Split cells using Split Text feature
Now that you are familiar with the inbuilt features, let me show you an alternative way to split cells in Excel. I mean the Split Text tool included with our Ultimate Suite for Excel. It can perform the following operations:
- Split cell by character
- Split cell by string
- Split cell by mask (pattern)
For example, splitting the participant details in one cell into several cells can be done in 2 quick steps:
- Select the cells you want to separate, and click the Split Text icon on the Ablebits Data tab, in the Text
- On the Split Text pane, configure the following options:
- Under Split by character, select Comma and Space as the delimiters.
- Select the Treat consecutive delimiters as one check box.
- Under Choose how to split cells, select Split to columns.
- Click the Split button.
Done! Four new columns with the split data are inserted between the original columns, and you only need to give those columns appropriate names:
- The Split Text tool provides two more options to divide a cell in Excel. For more information, please see How to split cells by string and How to separate cells by mask.
- To separate a column of names to the first name, last name and middle name, use a special Split Names tool.
If you are curious to see the Split Text and Split Names tools in action, we are welcome to download a 14-day trial version of our Ultimate Suite for Excel.
I thank you for reading and hope to see you on our blog next week!
162 comments to "How to split cells in Excel: Text to Columns, Flash Fill and formulas"
Hello!!!
I have a situation where I need to count letter after a different letter in a range.
For Eg:
1 2 3 4 5 6 7 8 9
A P P P P A P P P
I need only "P" letter to be counted after letter "A" is the condition. So, the result should be 3.
Please let me know the formula to get the result.
Thank you in advance!!!
Dear All, I need code to split this: 0.50, 0.67, 0.83 into different columns. Thank you.
Hi!
Have you tried the ways described in this blog post? Why couldn't you use them?
Container No
BMOU4616547(45G1), CXDU1285280(22G1), UETU2524349(20G1), CSNU1222152(22G0), OOLU1592935 (25G0), TRHU3872670(20G0), CSNU6027170(45G0)
Dear sir/madam
Above data is included in one Colum, i want only last code to separate the data.
how to split (45G1,22G1,20G1,22G0,25G0,45G0) In separate Colum.
please advise the same
Hi!
I'd recommend you to have a look at Split text tool.
It can split delimited text into columns. Use a mask
*(*)*
It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free.
Hi I have a column which contains three formats of data.
I need to sepearate the last three letters from the rest of the number (e.g. 1)/ number and letter (e.g. 2).
I tried text to column, but as there is no space or comma to spearte the stuff out, how can I separate it?
E.g.
1. 598284CAV
2. H28597KAL
Thanks in advance.
Shraddha
Hello!
You can separate the last 3 characters from the text using the RIGHT function.
I hope I answered your question.
Strauss Needle Diamond Bur Medium-E11M
Strauss Needle Diamond Bur Medium E31M
Strauss Flat End Cylinder Medium-D32M
Strauss Precision Depth Marker Red AD15C
Strauss Barrel Diamond Bur Coarse-M4C
Strauss Flat End Cylinder Coarse-D31C
Want to know how to separate codes from text
Hello!
Here is the formula that should work perfectly for you:
=TRIM(RIGHT(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A1,"-",REPT(" ",20)),20))," ",REPT(" ",20)),20))
I hope I answered your question. If something is still unclear, please feel free to ask.
This formula is amazing!!! Thank you so much for sharing. It has saved me and my team so much time and extra work.
Hello, I have a question. How do I separate if the delimiters are not consistent in the column?
Ex:
aaaaa_bbbbb
aaaaa-bbbbb
aaaaa_bbbbb
aaaaa-bbbbb
some use "_" while others use "-"
Hope someone can help me.
Thanks
Hello!
We have a tool that can solve your task in a couple of clicks - Ablebits Data - Split text.
It is available as a part of our Ultimate Suite for Excel that you can install in a trial mode and check how it works for free
How to prepare a dynamic sheet in excel with values in below sequence, but not of equal length but break from "-".
AB-CDEF-GHI-JK-LMN
A-BCDEF-G-HIJ-LMNO
This is the sequence of data.
con you please guide me to create a dynamic formulae -having output reads as below.
"AB" "CDEF" "GHI" "JK" "LMN"
Hello!
Please check out the following article on our blog, it’ll be sure to help you with your task: How to split cells in Excel: Text to Columns, Flash Fill and formulas.
I hope it’ll be helpful.
Hi,
How can I split the following information by slash:
WMCF1GL0621Z\TVIPACKBM1\WaferMapRecipe
Col A1: WMCF1GL0621Z
Col B1: TVIPACKBM1
Col C1: WaferMapRecipe
Thanks in advacne.
Hi,
What is the simplest method for the
e_mails of one account entered in excel automatically
and also the content of the e_mail spllited automatically into different cells
without a human present ?
Thanks in advance
Hello!
Unfortunately, without seeing your data it is difficult to give you any advice. Give an example of the source data and the expected result.
It’ll help me understand it better and find a solution for you.
Thank you very much, you saved me..
Hi,
Please,
I would like to separate these kind of cells: Nödinge Stommen 1:62 into
Collumn one: Nödinge Stommen
Collumn two 1
Collumn three 62
Thank you so much in advance
Hi, please i have an inventory report on excel, i want to know how i can sort out or separate those having quantity as 0 from others having number1....
Hello!
To separate some values from others without using formulas, you can apply a data filter or sort the values. Please have a look at this article.