Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default How do I sort by location within a cell in Excel?

I am trying to sort a list alphabetically but position within a cell. For
example, my cells contain: John Smith, Will Jones, Gary Roberts. I want to
sort by the last item in the cell. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default How do I sort by location within a cell in Excel?

Something like this to create a column you can sort by.

Sub sortbylast()
For Each c In Range("f2:f7")
c.Offset(, 1) = Right(c, Len(c) - InStrRev(c, " "))
Next
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Leigh" wrote in message
...
I am trying to sort a list alphabetically but position within a cell. For
example, my cells contain: John Smith, Will Jones, Gary Roberts. I want
to
sort by the last item in the cell. Thanks


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default How do I sort by location within a cell in Excel?

You would need a help column with the last names, then sort on the help
column.

=MID(A1,FIND("^^",SUBSTITUTE(A1," ","^^",LEN(A1)-LEN(SUBSTITUTE(A1,"
",""))))+1,255)


copy down in a help column will give you the last names unless they use
things like JR etc

then you can sort on that help column



--


Regards,


Peo Sjoblom


"Leigh" wrote in message
...
I am trying to sort a list alphabetically but position within a cell. For
example, my cells contain: John Smith, Will Jones, Gary Roberts. I want
to
sort by the last item in the cell. 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
Excel: Use pic location string to call up picuture in cell? vloh28 Excel Discussion (Misc queries) 1 October 30th 07 12:42 AM
Sort by Location ecohen1 Excel Worksheet Functions 1 November 28th 05 04:14 PM
hyperlink an excel cell to a specific location wthin application f dirtboy New Users to Excel 1 January 17th 05 08:07 PM
hyperlink an excel cell to a specific location wthin application f dirtboy Excel Discussion (Misc queries) 0 January 17th 05 08:03 PM
Excel Sort function should not sort the cell formatting! Lisa D.N.1 Excel Worksheet Functions 1 December 28th 04 08:37 PM


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