Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
al al is offline
external usenet poster
 
Posts: 363
Default Separate Concatenated First,Last Names

I have a spreadsheet which contains concatenated first and last names within
a cell which I have to separate. The Last Name is denoted by an Upper Case
First Letter.

An example is BillGates

How might a separate the first and last names into separate cells?

Thanks in advance.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Separate Concatenated First,Last Names

Select the cells you want processed and run:

Sub Separate()
Dim iloc As Long, i As Long
Dim cell As Range, sStr As String
For Each cell In Selection
sStr = cell.Value
i = Len(sStr) + 1
For iloc = Len(sStr) To 1 Step -1
If UCase(Mid(sStr, iloc, 1)) = Mid(sStr, iloc, 1) Then
i = iloc
Exit For
End If
Next
If i < Len(sStr) + 1 Then
cell.Value = Left(sStr, i - 1)
cell.Offset(0, 1).Value = Right(sStr, Len(sStr) - i + 1)
End If
Next
End Sub

This leaves the first name in the original cell and puts the last name in
the cell to the right.

--
Regards,
Tom Ogilvy

"Al" wrote in message
...
I have a spreadsheet which contains concatenated first and last names

within
a cell which I have to separate. The Last Name is denoted by an Upper

Case
First Letter.

An example is BillGates

How might a separate the first and last names into separate cells?

Thanks in advance.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to separate and rearrange names Nadine Excel Worksheet Functions 11 April 1st 10 11:36 PM
Separate First, Last Names BStacy Excel Discussion (Misc queries) 2 April 7th 09 06:44 PM
Names and Separate Worksheets Memento Excel Worksheet Functions 4 May 9th 07 01:20 AM
Splitting a concatenated string into separate rows... Natarajan Excel Worksheet Functions 1 May 4th 06 05:57 PM
Separate names into 2 columns? Ltat42a Excel Discussion (Misc queries) 8 December 11th 05 09:06 PM


All times are GMT +1. The time now is 08:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"