Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.newusers
|
|||
|
|||
Sort from the right
Using Word 2003.
I have a list of names of unequal word count. Some names in the list have only 1 word, some have 2 words, some have 3 words, some have more. I want to sort the list by the last name. In Word Perfect you used to be able to define a sort from the right by using a minus sign. For example, sort by word -1 which would start counting words from the right. Cannot find that option in Word 2003, but I'm wondering if there is some other mechanism for achieving the desired result. Example list that needs to be sorted by last name: Benjamin Franklin John Wilkes Booth Bill and Hillary Clinton George Washington J. Edgar Hoover Cher |
#2
Posted to microsoft.public.word.newusers
|
|||
|
|||
Sort from the right
I think this might help you. Click the Sort and click Options. Follow
instructions below. To change the options available, click on the options button on the Sort Text dialog box. The "Separate fields at" area has three choices: Tabs, Commas, or Other. Your text is separated by spaces, which puts it in the "Other" category. Click on Other, put a space in the blank area to the right of Other, and click on OK. The options available to sort by will now include Word 1, Word 2, etc. (one word choice for each word in a paragraph). Because the last name is the second word in each paragraph, you will choose Word 2 as the field to sort on. Now click on OK, and your lines of text will be sorted by the last name. If you wanted to sort by the social security number, you would choose Word 3. The only time you will have trouble sorting is when there is a variable number of words before the word you want to sort on. For example, suppose that in the list above you had typed a middle initial for some individuals but not for everyone. Now, the last name would sometimes be Word 2 (if there were no middle initial) and sometimes be Word 3 (if there were a middle initial). In other words, the initial would be considered the second "word" in the paragraph. Ardell "BK" wrote in message ... Using Word 2003. I have a list of names of unequal word count. Some names in the list have only 1 word, some have 2 words, some have 3 words, some have more. I want to sort the list by the last name. In Word Perfect you used to be able to define a sort from the right by using a minus sign. For example, sort by word -1 which would start counting words from the right. Cannot find that option in Word 2003, but I'm wondering if there is some other mechanism for achieving the desired result. Example list that needs to be sorted by last name: Benjamin Franklin John Wilkes Booth Bill and Hillary Clinton George Washington J. Edgar Hoover Cher |
#3
Posted to microsoft.public.word.newusers
|
|||
|
|||
Sort from the right
Thanks for the input, but the problem I have is the very one you describe at
the bottom of your message. The last name is not always Word 2 when counting from the left. (See the sample list of names I included in my original message.) The only consistent thing about the last name is that it is always the last word on the line. In Word Perfect, that made it "Word Number -1" which started counting from the right backwards because of the minus sign. I was hoping there would be something similar in Word. "Ardell" wrote in message ... I think this might help you. Click the Sort and click Options. Follow instructions below. To change the options available, click on the options button on the Sort Text dialog box. The "Separate fields at" area has three choices: Tabs, Commas, or Other. Your text is separated by spaces, which puts it in the "Other" category. Click on Other, put a space in the blank area to the right of Other, and click on OK. The options available to sort by will now include Word 1, Word 2, etc. (one word choice for each word in a paragraph). Because the last name is the second word in each paragraph, you will choose Word 2 as the field to sort on. Now click on OK, and your lines of text will be sorted by the last name. If you wanted to sort by the social security number, you would choose Word 3. The only time you will have trouble sorting is when there is a variable number of words before the word you want to sort on. For example, suppose that in the list above you had typed a middle initial for some individuals but not for everyone. Now, the last name would sometimes be Word 2 (if there were no middle initial) and sometimes be Word 3 (if there were a middle initial). In other words, the initial would be considered the second "word" in the paragraph. Ardell "BK" wrote in message ... Using Word 2003. I have a list of names of unequal word count. Some names in the list have only 1 word, some have 2 words, some have 3 words, some have more. I want to sort the list by the last name. In Word Perfect you used to be able to define a sort from the right by using a minus sign. For example, sort by word -1 which would start counting words from the right. Cannot find that option in Word 2003, but I'm wondering if there is some other mechanism for achieving the desired result. Example list that needs to be sorted by last name: Benjamin Franklin John Wilkes Booth Bill and Hillary Clinton George Washington J. Edgar Hoover Cher |
#4
Posted to microsoft.public.word.newusers
|
|||
|
|||
Sort from the right
You would have to add a Hard Space (Control Shift Space) between some of the
words to make it act as one word. So, if you had J. Edgar Hoover (which is 3 words), add (Control Shift Space) between the J. and Edgar. Then you have 2 words and you can control the sort. There's no simple minus code like WP had. "BK" wrote in message ... Thanks for the input, but the problem I have is the very one you describe at the bottom of your message. The last name is not always Word 2 when counting from the left. (See the sample list of names I included in my original message.) The only consistent thing about the last name is that it is always the last word on the line. In Word Perfect, that made it "Word Number -1" which started counting from the right backwards because of the minus sign. I was hoping there would be something similar in Word. "Ardell" wrote in message ... I think this might help you. Click the Sort and click Options. Follow instructions below. To change the options available, click on the options button on the Sort Text dialog box. The "Separate fields at" area has three choices: Tabs, Commas, or Other. Your text is separated by spaces, which puts it in the "Other" category. Click on Other, put a space in the blank area to the right of Other, and click on OK. The options available to sort by will now include Word 1, Word 2, etc. (one word choice for each word in a paragraph). Because the last name is the second word in each paragraph, you will choose Word 2 as the field to sort on. Now click on OK, and your lines of text will be sorted by the last name. If you wanted to sort by the social security number, you would choose Word 3. The only time you will have trouble sorting is when there is a variable number of words before the word you want to sort on. For example, suppose that in the list above you had typed a middle initial for some individuals but not for everyone. Now, the last name would sometimes be Word 2 (if there were no middle initial) and sometimes be Word 3 (if there were a middle initial). In other words, the initial would be considered the second "word" in the paragraph. Ardell "BK" wrote in message ... Using Word 2003. I have a list of names of unequal word count. Some names in the list have only 1 word, some have 2 words, some have 3 words, some have more. I want to sort the list by the last name. In Word Perfect you used to be able to define a sort from the right by using a minus sign. For example, sort by word -1 which would start counting words from the right. Cannot find that option in Word 2003, but I'm wondering if there is some other mechanism for achieving the desired result. Example list that needs to be sorted by last name: Benjamin Franklin John Wilkes Booth Bill and Hillary Clinton George Washington J. Edgar Hoover Cher |
#5
Posted to microsoft.public.word.newusers
|
|||
|
|||
Sort from the right
The following code sorts your list to:
John Wilkes Booth Cher Bill and Hillary Clinton Benjamin Franklin J. Edgar Hoover George Washington Go to Tools, Macros, Macros, Create and copy from sub to end sub below and paste to replace newly created empty sub. Return to your doc, select your list, go to tools, macros, macros, select lastwordsort and click run. It will add a tab character before the last word in each line, sort by field 2, and then delete the tabs. Sub LastWordSort() Set bkstrange = Selection.Range For Each p In bkstrange.Paragraphs p.Range.Select Selection.EndKey Unit:=wdLine Selection.MoveLeft Unit:=wdWord, Count:=1 Selection.TypeText Text:=vbTab Next p bkstrange.Select Selection.Sort FieldNumber:="Field 2" With Selection.Find .Text = "^t" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True .Execute Replace:=wdReplaceAll End With End Sub "BK" wrote: Using Word 2003. I have a list of names of unequal word count. Some names in the list have only 1 word, some have 2 words, some have 3 words, some have more. I want to sort the list by the last name. In Word Perfect you used to be able to define a sort from the right by using a minus sign. For example, sort by word -1 which would start counting words from the right. Cannot find that option in Word 2003, but I'm wondering if there is some other mechanism for achieving the desired result. Example list that needs to be sorted by last name: Benjamin Franklin John Wilkes Booth Bill and Hillary Clinton George Washington J. Edgar Hoover Cher |
#6
Posted to microsoft.public.word.newusers
|
|||
|
|||
Sort from the right
Thanks, I'll give it a try.
"BoniM" wrote in message ... The following code sorts your list to: John Wilkes Booth Cher Bill and Hillary Clinton Benjamin Franklin J. Edgar Hoover George Washington Go to Tools, Macros, Macros, Create and copy from sub to end sub below and paste to replace newly created empty sub. Return to your doc, select your list, go to tools, macros, macros, select lastwordsort and click run. It will add a tab character before the last word in each line, sort by field 2, and then delete the tabs. Sub LastWordSort() Set bkstrange = Selection.Range For Each p In bkstrange.Paragraphs p.Range.Select Selection.EndKey Unit:=wdLine Selection.MoveLeft Unit:=wdWord, Count:=1 Selection.TypeText Text:=vbTab Next p bkstrange.Select Selection.Sort FieldNumber:="Field 2" With Selection.Find .Text = "^t" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True .Execute Replace:=wdReplaceAll End With End Sub "BK" wrote: Using Word 2003. I have a list of names of unequal word count. Some names in the list have only 1 word, some have 2 words, some have 3 words, some have more. I want to sort the list by the last name. In Word Perfect you used to be able to define a sort from the right by using a minus sign. For example, sort by word -1 which would start counting words from the right. Cannot find that option in Word 2003, but I'm wondering if there is some other mechanism for achieving the desired result. Example list that needs to be sorted by last name: Benjamin Franklin John Wilkes Booth Bill and Hillary Clinton George Washington J. Edgar Hoover Cher |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Word 2000 Sort/alpha cannot sort in Finnish | Microsoft Word Help | |||
Word datasource sort doesn't sort all records in mail merge | Mailmerge | |||
How do I sort? | Microsoft Word Help | |||
Table Sort - Sort only 3 of 4 columns | Microsoft Word Help | |||
Sort by Last Name | Tables |