Title: Sort Function not Sorting Properly
Last modified: August 22, 2016

---

# Sort Function not Sorting Properly

 *  Resolved [SelectionsTiming](https://wordpress.org/support/users/selectionstiming/)
 * (@selectionstiming)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/)
 * Hi,
 * My table is working perfectly on my website except for the fact that when I sort
   numerical columns it doesn’t sort all of the fields properly. The sorting would
   show up something like this:
 * 2.1
    28.4 3.5
 * It does not seem to recognize the factor of decimal places. It seems to sort 
   only based on the first number. How can I get it to recognize the numbers in 
   their entirety so that they numerically sort properly?
 * [https://www.selectionsandtiming.com/searchabledatabase](https://www.selectionsandtiming.com/searchabledatabase)
 * Thanks
 * [https://wordpress.org/plugins/tablepress/](https://wordpress.org/plugins/tablepress/)

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

 *  Thread Starter [SelectionsTiming](https://wordpress.org/support/users/selectionstiming/)
 * (@selectionstiming)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/#post-5936220)
 * [https://www.selectionsandtiming.com/searchable-database/](https://www.selectionsandtiming.com/searchable-database/)
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/#post-5936245)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * Unfortunately, I couldn’t check your table, as the link you have posted only 
   asks me to log in or subscribe 🙁
 * Now, most likely, the reason for this is that not all values in that column are
   purely numeric. There must not be any text strings or characters in that column.
   Could that be the issue?
 * Regards,
    Tobias
 *  Thread Starter [SelectionsTiming](https://wordpress.org/support/users/selectionstiming/)
 * (@selectionstiming)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/#post-5936259)
 * So there can’t be any parentheses or periods? How can you insert the number so
   that it is purely numeric but also so that you can understand the actual value?
 * Thank you for the response!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/#post-5936262)
 * Hi,
 * periods (as decimal separators) are fine. Parentheses are not, because the sorting
   algorithm simply can not know how to treat those.
    Depending on the actual format
   that you use, you could have a look at the DataTables Sorting Plugins Extension
   from [http://tablepress.org/extensions/datatables-sorting-plugins/](http://tablepress.org/extensions/datatables-sorting-plugins/)
   That contains algorithms for some types of formatted numbers.
 * Regards,
    Tobias
 *  Thread Starter [SelectionsTiming](https://wordpress.org/support/users/selectionstiming/)
 * (@selectionstiming)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/#post-5936268)
 * Thank you.
 * I apologize for the inexperience, but once I have downloaded and activated the
   extension, will the datatables sorting plugin automatically apply? Or will I 
   need to reupload the table for it to apply?
 * Thanks
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/#post-5936279)
 * Hi,
 * it will automatically apply, but as mentioned on the Extension’s web page, you
   will have to add a “Custom Command” on the table’s “Edit” screen.
 * Regards,
    Tobias
 *  Thread Starter [SelectionsTiming](https://wordpress.org/support/users/selectionstiming/)
 * (@selectionstiming)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/#post-5936282)
 * One last question and then you have solved all of my issues!
 * For negative numbers, instead of parentheses, does the “-” work as a numerical
   sign that signifies negative? Or is it not possible to insert negative numbers?
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/#post-5936285)
 * Hi,
 * the `-` in front of a negative number will work just fine.
 * Regards,
    Tobias
 *  Thread Starter [SelectionsTiming](https://wordpress.org/support/users/selectionstiming/)
 * (@selectionstiming)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/#post-5936286)
 * Thank you for all of your help!
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/#post-5936290)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please [rate TablePress](https://wordpress.org/support/view/plugin-reviews/tablepress)
   here in the plugin directory. Thanks!

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

The topic ‘Sort Function not Sorting Properly’ 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/)

 * 10 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/sort-function-not-sorting-properly/#post-5936290)
 * Status: resolved