Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How do I sort multiple names within one cell?

How do I sort multiple names, all within a single cell, with all names
sharing a single task listed in an adjacent cell? Thank you!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default How do I sort multiple names within one cell?

a bit, as in a LOT, more detail would be helpful.

--
Don Guillett
SalesAid Software

"Deborah P. in Charlotte" <Deborah P. in
wrote in message
...
How do I sort multiple names, all within a single cell, with all names
sharing a single task listed in an adjacent cell? Thank you!



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default How do I sort multiple names within one cell?

Deborah

Are the names delimited by comma? If so use the macro as is.

If separated by a space, make adjustments at marked points.

Sub SortCell()
Dim i As Long, j As Long
Dim swap1, swap2
Dim varr
varr = Split(ActiveCell, ",")
' varr = Split(Activecell, " ") if space delimited
' peform bubble sort
For i = 0 To UBound(varr) - 1
For j = i + 1 To UBound(varr)
varr(i) = Trim(varr(i))
varr(j) = Trim(varr(j))
If varr(i) varr(j) Then
swap1 = varr(i)
swap2 = varr(j)
varr(j) = swap1
varr(i) = swap2
End If
Next j
Next i
ActiveCell.Value = Application.Trim( _
Join(varr, ", "))
'remove the comma from between the ", "
End Sub


Gord Dibben MS Excel MVP


On Tue, 10 Oct 2006 10:16:03 -0700, Deborah P. in Charlotte <Deborah P. in
wrote:

How do I sort multiple names, all within a single cell, with all names
sharing a single task listed in an adjacent cell? Thank you!


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
Help with this conditional IF statement C-Dawg Excel Discussion (Misc queries) 3 May 15th 06 06:01 PM
How can I sort multiple times Sorting data Excel Worksheet Functions 2 February 9th 06 05:22 PM
How do I split a cell into multiple rows/columns? SKA Excel Discussion (Misc queries) 1 January 18th 06 12:04 AM
Excel Sort function should not sort the cell formatting! Lisa D.N.1 Excel Worksheet Functions 1 December 28th 04 08:37 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


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