Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default sorting a column

I have a column with a last and a first names as follows

Employee Name
Thibodeau, Cheryl
Milan, Nick
Chian, Mary
Janzen, Eliane
.....

I need to sort it by the first name, which is the second word after the coma.

How could I do this?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default sorting a column

Give this function a try...

Public Function FormatName(ByVal InputName As String) As String
FormatName = Right(InputName, Len(InputName) - InStrRev(Trim(InputName),
" ")) & _
", " & Trim(Left(InputName, InStrRev(InputName, " ")))
End Function

"Alex" wrote:

I have a column with a last and a first names as follows

Employee Name
Thibodeau, Cheryl
Milan, Nick
Chian, Mary
Janzen, Eliane
....

I need to sort it by the first name, which is the second word after the coma.

How could I do this?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default sorting a column

Sorry the last function I Posted Changes names into to what you wnat to
convert them from... :-) Dopey Me...

"Alex" wrote:

I have a column with a last and a first names as follows

Employee Name
Thibodeau, Cheryl
Milan, Nick
Chian, Mary
Janzen, Eliane
....

I need to sort it by the first name, which is the second word after the coma.

How could I do this?

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default sorting a column

Use datatext to column to split or a helper column with the first name
only.

Sub namesplit()
For Each n In Selection
n.Offset(, 1) = Right(n, Len(n) - InStr(n, ","))
Next
End Sub

--
Don Guillett
SalesAid Software

"Alex" wrote in message
...
I have a column with a last and a first names as follows

Employee Name
Thibodeau, Cheryl
Milan, Nick
Chian, Mary
Janzen, Eliane
....

I need to sort it by the first name, which is the second word after the

coma.

How could I do this?

Thanks



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
Sorting a Pivot Table Column that is not the first column... [email protected] Excel Worksheet Functions 1 October 10th 07 09:02 PM
sorting by one column fst Excel Discussion (Misc queries) 1 February 21st 06 11:08 PM
How do I limit sorting a column to the column? Pat Excel Worksheet Functions 0 February 9th 06 04:01 PM
Right column doesn't change when sorting left column. nohope Excel Discussion (Misc queries) 2 July 19th 05 03:27 PM
Sorting a column regardless of whether a value if + or - Steve Excel Programming 1 October 5th 04 10:11 AM


All times are GMT +1. The time now is 08:15 PM.

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"