is now part of CreativePro.com!

Alphabetize Data in Tables

14

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!

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, CreativePro Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at LinkedIn Learning (Lynda.com) are among the most watched InDesign training in the world.
You can find more about David at 63p.com

Follow on LinkedIn here
  • L. Thomas Martin says:

    Or, third, buy WoodWing’s Smart Styles CS3.

    LTM

  • Woodwing’s Smart Styles for CS3 now has Sorting and Calculation with Formulas for tables !

    https:// www . woodwing . com
    Free tryout for 30 days.

  • Eugene says:

    I always copy the data and create a new table and convert that to text, as said above. But in CS3 once the cells and rows are the same count as the tabs you can simply copy the text that is tabbed in the document back into the table, it will go into the correct row and column.

    So there is no need to create a new table for this, just simply copy your tabbed text back into your table.

    I know it’s not much different than what was said already, but it’s a little different and it’s good to know that you can copy tabbed text right into a table, providing the tabs match the table layout.

  • Great! I didn’t know that SmartStyles did that now, and I thought I remembered seeing Peter’s script, but I couldn’t find it. Thank you for the links!

  • Eugene says:

    That link isn’t working for me, well it just goes to InDesignSecrets

  • Thanks, Eugene. My fault; I fixed it now.

  • Christopher S. says:

    Thank you for the link to that script, Harbs!

  • Anthony D. says:

    Wanted to point out that, on the Mac side at least, there is a clipboard enhancement called CopyPaste that provides a “Sort” command, context-menu accessible. However it handles the clipboard, it manages to actually sort an entire table in place, your choice of ascending or descending. Very nice; I’ve been using it to sort my tables for quite a while now.

  • inka says:

    You can link Excel or Word and Indesign files (go on “edit”, preferences, type, links). So after you edit something (like sorting, deleting, inserting etc.) in linked excel file, you click on “update link” in the palette “links”. You will lose some of formating in Indesign, but you can bring it easily back by applying previously created styles.

  • Floor Brink says:

    Smart Styles is also available for CS4

    https://www.woodwing.com/en/Smart_Styles

  • Paul Hanson says:

    I learned two things regarding this. First, to access the Scripts, go to Window ==> Utilities ==> Scripts.
    Second, if you are going to use the script mentioned to sort and you convert the table to text, make sure that before you do that you do not have paragraph marks within your cells! If you have paragraph marks, the script does not know that you had the lines that are separated by paragraph marks in the same cell in your table.

  • Amy says:

    I am using Peter’s script in ID CS4. However, our tables have one column that has images in it, and when I use the sort feature, the images disappear. Does anyone know a solution to this? Does the Woodwing software allow table sorting with images? Thanks!

  • GinaP says:

    Despite it being a runaround, the copying-to-Excel, sorting, then copying back to InDesign just saved me a large headache. So thank you. I’ve been saved by David Blatner for more years than I care to remember (decades!)

  • >