- To post as a guest, your comment is unpublished.· 2 years agoHello,
If the two words are same words, please change the first array formula to the follows:
Please remember to press Ctrl + Shift + Enter keys together.
Hope it can help you!
How to split text into separate columns by capital letter in Excel?
Supposing, you have a range of data that you want to split the cell contents into separate columns by the capital letter as the following screenshot shown, do you have any good ideas to solve this problem in Excel?
If there are only two words in your cells, the following formulas help you to finish this job. Please do as follows:
1. Enter this array formula: =LEFT(A2,SMALL(FIND(CHAR(ROW(INDIRECT("65:90"))),A2&"ABCDEFGHIJKLMNOPQRSTUVWXYZ"),2)-1) (A2 is the cell that you want to split by capital letter) into a blank cell which adjacent to your data, and then press Ctrl + Shift + Enter keys together to get the first word, see screenshot:
2. Then select C2, and drag the fill handle down to the cells that you want to apply this formula, all the first words of the range cells have been extracted at once, see screenshot:
3. Go on entering another formula: =REPLACE(A2,1,LEN(C2),"") (A2 is the cell that you want to split, and C2 is the cell contains the first word that you have returned) into cell D2, and press Enter key to get the second word, see screenshot:
4. Select cell D2, drag the fill handle down to the cells to get the second word, and the cell contents of the range have been split into two columns by the capital letter, see screenshot:
The above formulas only are applied to the cell value which contains two words, if there are multiple words in a cell needed to be split, you can add spaces before the capital letters, and then apply the Text to Columns to split the cell contents into separate columns by space.
First, apply VBA code to add spaces before the capital letter to separate the words.
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and paste the following code in the Module Window.
VBA code: Insert spaces before each capital letter in a cell
Function SplitWords(ByVal Str As String) As String 'updateby Extendoffice 20151128 Dim I As Integer SplitWords = Left(Str, 1) For I = 2 To Len(Trim(Str)) If (Asc(Mid(Str, I, 1)) > 64) And _ (Asc(Mid(Str, I, 1)) < 91) And _ (Mid(Str, I - 1, 1) <> " ") Then _ SplitWords = SplitWords & " " SplitWords = SplitWords & Mid(Str, I, 1) Next End Function
3. Save and close this code, go back to the worksheet, please enter this formula: =splitwords(A2) into a blank cell adjacent your data, see screenshot:
4. Then drag the fill handle down to the cells that you want apply this formula, and the spaces have been inserted before each capital letter to separate the cell contents, see screenshot:
5. And then you should copy and paste theses formula cells as values to remove the formulas in another place or the original range.
Second, apply the Text to Column feature to split the cell contents into separate columns by the space.
6. Select the cell values you have inserted spaces, and click Data > Text to Columns, in Step1 of the Convert Text to Columns Wizard, select Delimited option, see screenshot:
7. Then click Next button, in Step2 of the wizard, check Space option under the Delimiters section, see screenshot:
8. Go on clicking Next button, in Step3 of the wizard, choose General option under the Column data format, and then select a cell where you want to put the split values by clicking button, see screenshot:
9. At last, click Finish button, the cell contents have been split into multiple columns as following screenshot shown:
If you have Kutools for Excel, combining its Add Text and Split Cells features, you can deal with this task easily and comfortably, please do as follows:
|Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.|
1. Select the original data that you want to split.
2. Then click Kutools > Text > Add Text, see screenshot:
3. In the Add Text dialog box, please type the space bar once or any other separator you need into the Text box, and then choose 1 st letter is uppercase from the Only add to section, see screenshot:
4. Then click Ok button, and spaces have been added before each capital letter, see screenshot:
5. And then you can apply the Split Cells utility of Kutools for Excel to split the cell values by space, keeping the data range selected and then click Kutools > Merge & Split > Split Cells, see screenshot:
6. In the Split Cells dialog box, select Split to Columns under the Type section, and check Space or other delimiters that you added in Step 3, see screenshot:
7. Then click Ok, and a prompt box is popped out to remind you select a cell to put the split data, see screenshot:
8. At last, click OK button, and you will get the result you need, see screenshot:
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 2 years agoThis doesn't work for two of the same capital letters
- To post as a guest, your comment is unpublished.· 3 years agoThanks for the content it really worked
- To post as a guest, your comment is unpublished.· 4 years agoYour formula fail if name is like this: