Skip to main content

How to split text into separate columns by capital letter in Excel?

doc split by capital 1

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?

Split text into separate columns by capital letter with formulas

Split text into separate columns by capital letter with VBA code

Split text into separate columns by capital letter with Kutools for 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:

doc split by capital 2

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:

doc split by capital 3

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:

doc split by capital 4

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:

doc split by capital 5


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:

doc split by capital 6

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:

doc split by capital 7

5. And then you should copy and paste theses formula cells as values to remove the formulas in another place or the original range.

doc split by capital 8

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:

doc split by capital 9

7. Then click Next button, in Step2 of the wizard, check Space option under the Delimiters section, see screenshot:

doc split by capital 10

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 doc split by capital 12 button, see screenshot:

doc split by capital 11

9. At last, click Finish button, the cell contents have been split into multiple columns as following screenshot shown:

doc split by capital 13


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 KutoolsText > 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:

doc split by capital 15

4. Then click Ok button, and spaces have been added before each capital letter, see screenshot:

doc split by capital 16

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:

doc split by capital 18 18

7. Then click Ok, and a prompt box is popped out to remind you select a cell to put the split data, see screenshot:

doc split by capital 19

8. At last, click OK button, and you will get the result you need, see screenshot:

doc split by capital 20

Download and free trial Kutools for Excel Now !


Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Download and free trial Now!

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (8)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hola! Llevo todo el dia tratando de divir palabras juntas en celdas en excel, he dado con esta pagina, pero el código VBA no me funciona, tengo entendido que =Splitwords ya no esta disponible.
Es posible que puedas ayudarme?
This comment was minimized by the moderator on the site
Formula/function works as it should now, a later amendment (#25891) fixed it - thank you so much
This comment was minimized by the moderator on the site
DanMorgan = Dan
MollieClark = Mollie
Jade, Jam, Ryan, Dummy (not his real name),Jess,Cass, Jenni and Jack all come through as Jade,Jam, etc

using Excel 2013 (company supplied)
This comment was minimized by the moderator on the site
I need some help splitting a cell. I can do it by lower case next to upper case. But if the splitting word is one capitol letter, followed by another capitol letter it won't work. Also, if there are Roman numerals involved there are problems. If there is a word, such as "McDonald" or "MacDonald" there are problems. Can you help?
This comment was minimized by the moderator on the site
This doesn't work for two of the same capital letters
This comment was minimized by the moderator on the site
Hello,
If the two words are same words, please change the first array formula to the follows:
=LEFT(A2,SMALL(FIND(CHAR(ROW(INDIRECT("65:90"))),RIGHT(A2, LEN(A2)-1)&"ABCDEFGHIJKLMNOPQRSTUVWXYZ"),1))

Please remember to press Ctrl + Shift + Enter keys together.

Hope it can help you!
This comment was minimized by the moderator on the site
Thanks for the content it really worked
This comment was minimized by the moderator on the site
Your formula fail if name is like this: JhonJhon MarkMark
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations