| View previous topic :: View next topic |
| Author |
Message |
FleurdeSaison Newbie

Joined: 25 Feb 2007 Posts: 2
|
Posted: Sun Feb 25, 2007 3:59 pm Post subject: Sorting in Calc -- How to ignore the leading "the" |
|
|
| 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 |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 7649 Location: Germany
|
Posted: Sun Feb 25, 2007 6:05 pm Post subject: |
|
|
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 |
|
 |
FleurdeSaison Newbie

Joined: 25 Feb 2007 Posts: 2
|
Posted: Sat Mar 10, 2007 9:26 pm Post subject: |
|
|
| Thanks for your help! |
|
| Back to top |
|
 |
|