ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sorting a column (https://www.excelbanter.com/excel-programming/327937-sorting-column.html)

ALEX

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

Jim Thomlinson[_3_]

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


Jim Thomlinson[_3_]

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


Don Guillett[_4_]

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





All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com