Alphabetize Data in Tables
Christopher wrote: Do you know how to sort data in a table? From time to time, we need to change around the data in our tables. I always end up...
Christopher wrote:
Do you know how to sort data in a table? From time to time, we need to change around the data in our tables. I always end up manually re-alphabetizing. But I wish I could find a way to sort it like you can in Excel.
Pariah Burke wrote a really good article in the last issue of InDesign Magazine in which he talked about this very thing. I would encourage you to get that article and read it through. But the quick answer is: There’s really no good way to do this, but there are two mediocre ways.
[Editor’s Note: There’s a newer version of this topic at this link. And Peter Kahrel wrote a terrific script for sorting/alphabetizing tables here.]
SortParagraphs
There’s a script called SortParagraphs that comes with InDesign CS3 (in CS2, it’s on the installation discs). This is a great script for sorting or alphabetizing paragraphs. Unfortunately, it doesn’t work for tables. So, you would need to convert that data from a table to text by selecting the table with the Type tool and choosing Table > Convert Table to Text. Then select the text, run the script (double-click on it), select the text again, and convert it back to a table (Table > Convert Text to Table).
If you don’t want to convert the whole table to text, you could select the rows you do want to sort, copy them, paste them elsewhere, convert-sort-convert, and copy the data back. (Copying and pasting data like this is available only in CS3. If you have CS2, you’d need the PopTbFmClip script from Dave Saunders.)
I’m hoping that in a future version, Adobe will update the script so that it works on table data, too.
Use Excel
If you don’t want to use that script for some reason, you can use Excel’s sort feature (which is definitely superior and more flexible). In this case, you would select the table rows you want to sort in InDesign, copy them to the clipboard, paste them into Excel (or Numbers, or whatever spreadsheet program you’re using), sort them, then copy-and-paste them back.
As we’ve noted earlier, the ability to paste data back into table cells is new in CS3, and the trick is you need to select the cells themselves (make sure at least one cell is selected… not just have a flashing cursor inside the cell).
If anyone can offer a better solution to alphabetizing tabular data, I’d love to hear it!
This article was last modified on July 27, 2023
This article was first published on March 28, 2008
