A problem of sorts
December 18, 2007 5:12 AM Subscribe
This is a very basic Word 2003 question. I have a list of 50 countries in descending alfabetical order. I've used the "convert text to table function" in Word (2003) to put them in a table (5 columns, 10 rows). Up to here, everything is fine.
However, they've been automatically sorted alphabetically from left to right and then from top to bottom (first by column and then by row). I want them to be sorted alphabetically the other way around (top to bottom and then left to right - by row and then column). Is there any way to do this automatically without having to manipulate the data or adding it manually to the table? It's a very simple table and it wouldn't take a very long time but I'm just curious to see how others would tackle this very simple problem.
Thanks
However, they've been automatically sorted alphabetically from left to right and then from top to bottom (first by column and then by row). I want them to be sorted alphabetically the other way around (top to bottom and then left to right - by row and then column). Is there any way to do this automatically without having to manipulate the data or adding it manually to the table? It's a very simple table and it wouldn't take a very long time but I'm just curious to see how others would tackle this very simple problem.
Thanks
Best answer: The only way I was able to figure it out was to use Excel as an "intermediary". I don't know if this will work:
(It is a lot easier to do than it reads!)
1) In Word, copy all the cells of your table
2) Open Excel and click Paste (Edit, Paste). The table data should be added to 50 Excel cells in the same format as your Word table
3) Copy all 50 cells in the Excel sheet (Select the cells, then click Edit, Copy)
4) Move to a different place in the Excel sheet and click Edit, Paste Special.
5) In the Paste Special dialog box that appears, check Transpose and click OK (the All radio button in the Paste pane and the None radio button in the Operation pane should also be selected).
6) Now you have a new array of cells - 5 rows x 10 columns
7) Cut the content of the second column and place it under the first column
8) Cut the content of the fourth column and place it under the third column
9) Repeat as above until you have placed all the content of the even-number columns under the odd number columns
10) Remove the 2nd, 4th, 6th, and 8th columns (which should now be empty) - select the entire column, and click Edit, Delete.
11) Finally select all 50 cells (the new ones you just pasted) and copy them back into your Word document!
Phew! I hope this works!
posted by bitteroldman at 5:37 AM on December 18, 2007 [1 favorite]
(It is a lot easier to do than it reads!)
1) In Word, copy all the cells of your table
2) Open Excel and click Paste (Edit, Paste). The table data should be added to 50 Excel cells in the same format as your Word table
3) Copy all 50 cells in the Excel sheet (Select the cells, then click Edit, Copy)
4) Move to a different place in the Excel sheet and click Edit, Paste Special.
5) In the Paste Special dialog box that appears, check Transpose and click OK (the All radio button in the Paste pane and the None radio button in the Operation pane should also be selected).
6) Now you have a new array of cells - 5 rows x 10 columns
7) Cut the content of the second column and place it under the first column
8) Cut the content of the fourth column and place it under the third column
9) Repeat as above until you have placed all the content of the even-number columns under the odd number columns
10) Remove the 2nd, 4th, 6th, and 8th columns (which should now be empty) - select the entire column, and click Edit, Delete.
11) Finally select all 50 cells (the new ones you just pasted) and copy them back into your Word document!
Phew! I hope this works!
posted by bitteroldman at 5:37 AM on December 18, 2007 [1 favorite]
Best answer: Wait, so your data is like this:
A B C
D E F
G H I
but you want iit like this:
A D G
B E H
C F I
? If so, then just highlight all the data and hit copy. Then (in a new worksheet, to be safe, or just below your existing data) right click and select "Paste Special". Click the "Transpose" checkbox in the bottom right, and hit okay.
posted by inigo2 at 6:02 AM on December 18, 2007
A B C
D E F
G H I
but you want iit like this:
A D G
B E H
C F I
? If so, then just highlight all the data and hit copy. Then (in a new worksheet, to be safe, or just below your existing data) right click and select "Paste Special". Click the "Transpose" checkbox in the bottom right, and hit okay.
posted by inigo2 at 6:02 AM on December 18, 2007
If you can't/don't want to use Excel (inigo2's Transpose suggestion is the easiest), I would use VBA. Word's table functionality is pretty limited compared to Excel.
posted by SuperSquirrel at 6:31 AM on December 18, 2007
posted by SuperSquirrel at 6:31 AM on December 18, 2007
The suggested transpose wouldn't work, because the table isn't square.
posted by signal at 6:32 AM on December 18, 2007
posted by signal at 6:32 AM on December 18, 2007
The table doesn't have to be square for the transpose to work in Excel.
posted by DevilsAdvocate at 6:47 AM on December 18, 2007
posted by DevilsAdvocate at 6:47 AM on December 18, 2007
Best answer: Can you abandon the table, and have the data in a five-column section instead? That would be simpler imo. I'm not near "my" pc so can't check the actual Word commands, but basically you have the countries in a list (sorted alphabetically) and have that list shown in five columns. The column arrangement is per-section, iirc, so you'd have to define three sections, with the parts before and after the list in normal sections, and only the list in the five-column section. Look for 'columns' on the Format menu (and in help).
posted by anadem at 7:53 AM on December 18, 2007
posted by anadem at 7:53 AM on December 18, 2007
anadem's got it! Put borders around the columns, put a line between columns, and set the spacing to 0 and it looks just like a table. Once you get it set the way you like, record a macro of your steps, put an icon on your toolbar that calls that macro, and the whole thing becomes a 1-2 step process in the future.
posted by SuperSquirrel at 9:32 AM on December 18, 2007
posted by SuperSquirrel at 9:32 AM on December 18, 2007
Response by poster: Thanks guys. All of these are great suggestions. I was in a hurry so ended up doing it manually because it was such a small table but I'll definitely keep this for future reference.
posted by juva at 10:57 AM on December 18, 2007
posted by juva at 10:57 AM on December 18, 2007
This thread is closed to new comments.
If all else fails, (I really am a one-trick pony) then a tiny bit of Python:
>>> x = ((1,2,3),(4,5,6),(7,8,9))
>>> zip(*x)
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]
posted by cmiller at 5:24 AM on December 18, 2007