OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Sorting in Calc -- How to ignore the leading "the"

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
FleurdeSaison
Newbie
Newbie


Joined: 25 Feb 2007
Posts: 2

PostPosted: Sun Feb 25, 2007 3:59 pm    Post subject: Sorting in Calc -- How to ignore the leading "the" Reply with quote

When I sort phrases in Calc, the leading "the" of any phrase is always used to sort them. Is the any way to ignore it when sorting?
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 7649
Location: Germany

PostPosted: Sun Feb 25, 2007 6:05 pm    Post subject: Reply with quote

I tested with A1:A5
almighty
thealmighty
the almighty
The almighty
the,almighty
B1 =IF(ISNUMBER(SEARCH("^[tT]he\>";A1));SEARCH("\<[:alnum:].+";A1;4);1)
C1 =MID(A1;B1;LEN(A1))
Now you can sort by column C
C returns the part starting at the position, calculated in B
B1 tests if A1 starts with "The" or "the", followed by a word-boundary.
If this is true, then it returns the position of the next word-boundary, followed by some alphanumeric chars, otherwise it returns 1.
See help on regular expressions.
_________________
XUbuntu 9.04, OOo 3.1.1(Sun), Sun Java 1.5.0_06
Back to top
View user's profile Send private message
FleurdeSaison
Newbie
Newbie


Joined: 25 Feb 2007
Posts: 2

PostPosted: Sat Mar 10, 2007 9:26 pm    Post subject: Reply with quote

Thanks for your help!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group