Title: Getting numbers to sort correctly
Last modified: August 21, 2016

---

# Getting numbers to sort correctly

 *  Resolved [Monostudio](https://wordpress.org/support/users/monostudio/)
 * (@monostudio)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/getting-numbers-to-sort-correctly/)
 * Hi there – probably in here somewhere, (sorry if I have missed it) trying to 
   get a list of numbers to sort. 5 7 9 10 15 etc. I get 10 15 5 7 9. On the demo
   table I see it is sorting correctly – how is this done? Ideally the size chould
   be 5 x 5, 10 x 5 etc. but have simplified (as long as it reads the first number.
   Thanks Tim
    Test page is here: [http://signature.uk.cloudlogin.co/wordpress/signature-range/](http://signature.uk.cloudlogin.co/wordpress/signature-range/)
 * [http://wordpress.org/plugins/tablepress/](http://wordpress.org/plugins/tablepress/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/getting-numbers-to-sort-correctly/#post-3981294)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * The reason for this problem is the cell with “8 diameter”, which is a string 
   and not a number. Due to that, the sorting algorithm treats the entire column
   as strings and not as numbers, which are simply sorted differently and give you
   the current results.
 * So, the easiest fix would be just remove the ” diameter” from the cell, so that
   all cells in that column are numbers.
    If that’s not an option, you could install
   the TablePress Extension from [http://tablepress.org/extensions/datatables-sorting-plugins/](http://tablepress.org/extensions/datatables-sorting-plugins/)
   and add this to the “Custom Commands” textfield on the “Edit” screen of the table:
 *     ```
       "aoColumnDefs": [ { "sType": "formatted-num", "aTargets": [ 2 ] } ]
       ```
   
 * The `2` indicates that the third column should get “special treatment” (counting
   the columns starts with 0 in the code).
 * Regards,
    Tobias
 *  Thread Starter [Monostudio](https://wordpress.org/support/users/monostudio/)
 * (@monostudio)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/getting-numbers-to-sort-correctly/#post-3981295)
 * Thanks Tobias for such a speedy response – have just downloaded the extension–
   will have a look later. Tim
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/getting-numbers-to-sort-correctly/#post-3981296)
 * Hi Tim,
 * no problem, you are very welcome!
    If this doesn’t help, just let me know!
 * Best wishes,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Getting numbers to sort correctly’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

## Tags

 * [incremental](https://wordpress.org/support/topic-tag/incremental/)

 * 3 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/getting-numbers-to-sort-correctly/#post-3981296)
 * Status: resolved