Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Reversing names and sorting

I have a list of between 6 and 10 names that I regularly have to reverse
(display last name first) and sort.
They have corresponding data attached to each name that needs to be sorted
also.
For example:
First name would be in Row 44 let's say.....

Col L Col M Col N Col O Col
P Col Q Col R Col S Col T
Row Name Hours Gross Fed SS
Medicare State city Net
44 John Smith 39 457.60 81.10 13.66
7.25 6.95 4.57 365.00
45 Jane R. Doe 40 319.97 72.10 11.44
6.15 5.20 3.19 258.77
46 and so on......

Final result needs to be like this:
44 Smith, John 39 457.60 81.10
13.66 7.25 6.95 4.57 365.00
45 Doe, Jane R. 40 319.97 72.10 11.44
6.15 5.20 3.19 258.77
46 and so on......

Any and all help would be appreciated.
Jonco


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Reversing names and sorting

Here is a function to reverse the name for you...

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

You call it like this...

Sub test()
Dim x As String
x = FormatName("Dave P. Sloan")
End Sub

HTH

"jonco" wrote:

I have a list of between 6 and 10 names that I regularly have to reverse
(display last name first) and sort.
They have corresponding data attached to each name that needs to be sorted
also.
For example:
First name would be in Row 44 let's say.....

Col L Col M Col N Col O Col
P Col Q Col R Col S Col T
Row Name Hours Gross Fed SS
Medicare State city Net
44 John Smith 39 457.60 81.10 13.66
7.25 6.95 4.57 365.00
45 Jane R. Doe 40 319.97 72.10 11.44
6.15 5.20 3.19 258.77
46 and so on......

Final result needs to be like this:
44 Smith, John 39 457.60 81.10
13.66 7.25 6.95 4.57 365.00
45 Doe, Jane R. 40 319.97 72.10 11.44
6.15 5.20 3.19 258.77
46 and so on......

Any and all help would be appreciated.
Jonco



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
Reversing first and last names in one cell Té Excel Discussion (Misc queries) 6 December 29th 09 07:50 PM
Reversing Last Name and First Names Marvin Excel Discussion (Misc queries) 2 May 1st 07 10:34 PM
Sorting and matching rows of names with Socials with master list and eliminating the extra names Giacomo Excel Worksheet Functions 1 March 10th 07 01:52 AM
Reversing First and Last Names excelnewbie Excel Discussion (Misc queries) 5 June 10th 05 03:59 PM
sorting names alphabetically when names may start with numbers John Smith Excel Discussion (Misc queries) 3 May 11th 05 08:06 PM


All times are GMT +1. The time now is 01:17 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"