Split name in a column without spaces or commas

LGF

New Member
Joined
Oct 11, 2006
Messages
1
I have a list of 1st and last names in a column that I would like to split into two columns. The 1st and last names are not separated by a space or comma - they are only identifiable by capital letters (eg. SteveSmith). How can I break up the names?
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
Hi
UDF if you like
1) hit Alt + F11 To open VB Editor
2) go to [Insert] - [Module] then paste the code there
3) close the window to get back to excel
If data is in A1 then select B1:C1(or any horizontal consecutive 2 cells) and enter
=FLName(A1)
Confirm with Ctrl + Shift + Enter
Code:
Function FLName(txt As String)
Dim FName As String, LName As String, i As Integer, mItem As Object
With CreateObject("VBScript.RegExp")
   .Pattern = "[A-Z][a-z]+"
   .Global = True
   Set mItem = .execute(txt)
   If mItem.count>1 Then
      FName = mItem(0)
      For i = 2 To mItem.count
         LName = LName & mItem(i-1)
      Next
   Else
      FName = txt
   End If
End With
FLName = Array(FName,LName)
End Function
 

Forum statistics

Threads
1,136,878
Messages
5,678,320
Members
419,755
Latest member
eshnider21

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top