#1   Report Post  
Ronnie
 
Posts: n/a
Default Sorting

I was making a list of movies and I'm wanting to sort them by name, but how
can I get excel to ignore words like "the" and "a" and recognize the first
word after that
  #2   Report Post  
bigwheel
 
Posts: n/a
Default

i've done something similar and my solution was to use the following:-

Sub SortThis()
Do Until IsEmpty(ActiveCell)
strTitle = ActiveCell.Value
numSize = Len(strTitle)
If Left(strTitle, 3) = "The" Then
ActiveCell.Offset(0, 3) = Right(strTitle, (numSize - 4)) & ",The"
ElseIf Left(strTitle, 2) = "A " Then
ActiveCell.Offset(0, 3) = Right(strTitle, (numSize - 2)) & ", A"
Else
ActiveCell.Offset(0, 3) = strTitle
End If
ActiveCell.Offset(1, 0).Select

Loop
End Sub

So, with the first title selected, the macro copies the title to a new
column and tags "The" or "A" to the end of the title. Then you can sort the
resulting range as you wish (add it into the macro perhaps)

"Ronnie" wrote:

I was making a list of movies and I'm wanting to sort them by name, but how
can I get excel to ignore words like "the" and "a" and recognize the first
word after that

  #3   Report Post  
Jim Cone
 
Posts: n/a
Default

Ronnie,

My brand new Excel add-in "Special Sort" (beta2) will do that.
It ignores leading "A", "An", "The" and sorts the list for you.
It also provides six additional "special" methods to sort with.

Available -free- upon direct request. Remove XXX from my email address.

Jim Cone
San Francisco, USA
XX


"Ronnie" <Ronnie @discussions.microsoft.com wrote in message
...
I was making a list of movies and I'm wanting to sort them by name, but how
can I get excel to ignore words like "the" and "a" and recognize the first
word after that
  #4   Report Post  
David McRitchie
 
Posts: n/a
Default

Hi Ronnie,
Another way just using worksheet formulas:
SUBSTITUTE is case sensitive

Do you include "The" in the sort if it is the first word?

Create a helper column.
=TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE( SUBSTITUTE(LOWER(A16)," and "," ")," the "," ")," a "," ")," on "," ")," in ","
"))

The Wind in the Willows the wind willows
The Cat and the Fiddle the cat fiddle
Thousand and One Space Odessey thousand one space odessey
The Prince and the Pauper the prince pauper

If you want the as the first word to disappear
instead of TRIM(A16) use
=" " & A16
and then you could add one more substitution

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Ronnie" <Ronnie @discussions.microsoft.com wrote in message ...
I was making a list of movies and I'm wanting to sort them by name, but how
can I get excel to ignore words like "the" and "a" and recognize the first
word after that




  #5   Report Post  
Bill Ridgeway
 
Posts: n/a
Default

It is all very well relying on doing things automatically with, say, macros.
The problem with this approach is that unless the macro is well written and
positively tested to cover all conditions you can get into the "it must be
OK if it was done by the computer" mentality and have a database with some
'funnies'. Either testing to make sure the macro is comprehensive or
checking after running you may have to check every record.

I would suggest a helper column with the first 5 significant characters of
the title. Sorting on this column should do the job.

Regards.

Bill Ridgeway
Computer Solutions

"Ronnie" <Ronnie @discussions.microsoft.com wrote in message
...
I was making a list of movies and I'm wanting to sort them by name, but how
can I get excel to ignore words like "the" and "a" and recognize the first
word after that



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
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
Sorting 1, 1A, 2, 2A, 3, 4, 4A, 4B . . . agc1234 Excel Discussion (Misc queries) 6 May 26th 05 08:02 PM
sorting number in ascending order Janice Lee via OfficeKB.com Excel Discussion (Misc queries) 2 April 8th 05 10:31 PM
SORTING question Rebecca New Users to Excel 3 February 24th 05 05:35 PM
Adding a KeyID column for sorting Rebecca New Users to Excel 3 February 20th 05 07:09 PM


All times are GMT +1. The time now is 10:33 AM.

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"