Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More than three sorting criteria for mail merges in Word XP 1

Status
Not open for further replies.

smgeorge99

Programmer
Jun 6, 2003
21
0
0
US
Is it possible to have more than three sorting criteria in a mail merge document in Word XP?

I'm creating a company listing that needs to be sorted by company. Under the company the people who work for that company will be listed in alphabetical order by their last name. The thing is that companies can have multiple addresses, and those companies with multiple addresses must be listed in order by their state.

So, I need to sort by Company Name, Company State, Company Address, Employee Last Name. That's four sorting criteria, and Word only seems to allow me to sort by three criteria.

Any suggestions would be greatly appreciated.
 
Hi,

Back in the "olden days" of punched cards, also known as Hollerith Cards, there were big, bulky, noisy card sorters.

Guess what? A card sorter can only sort on ONE COLUMN! So what would you do if you had a ZIP CODE of 5 columns? SOL? Nope!

You begin sorting from the LEAST SIGNIFICANT position to the MOST SIGNIFICANT position.

That's how it works :)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Skip,

I'm not quite sure that I understand your answer. I know how to sort my data, but I need four criteria, and Word only allows three.

Assume that I have no control over the data source; it's a comma-delimited file that is generated by another application, so I can't reorder the fields. I also don't have MS Access, so I can't import the CSV file into an Access table and use the Access queries as my data source.

Any suugesttions?
 
First you sort on the least significant field.

Then you sort on the 3 most significant field, since you can do 3 at a time.

Using this strategy, it is possible to sort on HUNDREDS of fields!

:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
I thought of that, but I wasn't sure if that would be enough to guarantee that everything would be sorted properly everytime. It's very important that the sort be correct, as the results will be sent to a printer to be made into directories for a large meeting.
 
When IBM and Burroughs and GE and Mutual of Omaha sorted their punch cards, and remember, there were up to 80 columns of data, each column was a separate sort.

So it might take 80 passes through the ole sorting machine to get the card deck sorted properly...

least significant column to most significant column.

:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
I don't know why you want to sort on address. The alphabetical breakdown by address is meaningless. As I understand your needs, you need 3 criteria...name, state, company.
 
The reason for sorting on address is for the cases where a company has multiple locations in one state. The employees must be listed under the company's location where they work.


The final report should look something like this:

Campbell Soup Company
8367 East Renada
Scottsdale, AZ 85255

SMITH, Gordon
Vice President West

Campbell Soup Company
PO Box 1657
Colfax, CA 95713

WALLS, Steve
Regional Director - West

Campbell Soup Company
1235 Old Alpharetta Road
Suite 170
Alpharetta, GA 30005

THORN, Jake
Regional Director

YOUNG, Michael
Senior Vice President

Dean Specialty Foods Group
857-897 School Place
Green Bay, WI 54303

MICHAELS, Paul
Associate

Dearborn Wholesale Grocers
2801 S. Western Ave.
Chicago, IL 60608-5280

FROST, Shane
President

KING, Brevin
Vice President, Advertising

MARX, Ron
Director, Purchasing

Sorting by address is a crude way of grouping the unique company locations together, but still ordering the directory by company name, company state, then list the employees alphabetically by last name.

If anyone can come up with a more elegant solution, I'm all ears.
 
You could divide the spreadsheet by company into separate sheets, then sort each sheet by state, city and employee. The consolidate alll the sheets in the workbook. In fact, it might be handy to have the workbook divided into sheets by company.
 
jfh,

That is an EXTREMELY BAD idea. Data should almost NEVER be chopped up and placed in separate sheets/workbooks!

smgeorge99's problem has a simple sorting solution. It would not matter if there were a dozen fields to sort! To do as you suggested would be a DISASTER!

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Skip,

I tried (at least I think I did what you mentioned) your approach, and it did not work. I sorted my Excel spreadsheet in least significant order (by last name). I then sorted the data in my mail merge document by Company first, then by State, then by Line 1 address. The merged document still has the people in the wrong order. Apparently the mail merge reordered the document and did not keep things in the same order they were in the data source (outside of the three sorting criteria I outlined in my mail merge document, of course).

Any other ideas, or did I misunderstand you?

Thanks,

Sean
 
I set up some sample data with 4 columns as you describe and sorted it as described

In Excel Sort Name Ascending

In Word Sort by Company, State, Address -- each ascending

The order is PERFECT.

In fact, I tested it by sorting the Names in DESCENDING order and...

The resulting order is PERFECT with names in descending rather than ascending order within Company, State and Address.

???

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Hmmm, I tried it again and it worked fine. Maybe there was some other issue going on, because I was having other issues with saving the query criteria for the merge.

Skip, thanks a bunch for your solution and your time. You get a star!

Sean
 
Sean,

Glad I could help and thanks!

Just remember that important sorting concept and you will NEVER be limited...

least significant to most significant!

:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top