There are tables in our app with a sortable position column which contains values between 0 to 50. Which, in our case, 0 means the item cannot be found.

So the question is, when sorting the column ascending / low to high, should the 0 values be displayed first or last? Keeping in mind that these 0 values are still important to users as they need to fix them so they'll have a > 0 position.

Also, these positions are not unique, meaning there could be cases where there are > 100 0 values and the users will have to go to the 2nd or 3rd page of the table to see the best positions, which are 1

As for the meaning of the values, they represent the position in search engine results for the keywords that users are tracking for their website. So in our case, 0 means that the user's website doesn't show up in search results for that specific keyword. So users will be more interested in the keywords that have position 1, 2 or 3.

Here is the table for a better understanding of my question:

table demo

As you can see in the above, the table is sorted asc by position, so what users are really interested in is those keywords that have a > 0 position to see their changes over a period of time.

  • Maybe I'm not understanding your question but: If the 0 values require user action to "fix" as you say, shouldn't they be pinned to the top?
    – Pdxd
    Jun 26, 2015 at 13:25
  • Not necessarily. They can "fix" them by making changes to their website so that it will show up in search results for that specific keyword or by creating "Ad Campaigns", but most of them will remove them altogether. I guess what I was trying to say by "important" was that they can't be removed from the table (I'll update my question providing more detail on the 0 value importance)
    – Razvan B.
    Jun 26, 2015 at 13:32

2 Answers 2


If you're displaying the value 0 you should definitely have it before 1 and 2, etc. When you sort based on ordinal values, you should be consistent, otherwise you are almost certainly going to confuse users. For example, what if you have many items, and the items with 0 value are shown at the end of a list 1 million long. That would be terrible UX wise.

If you're showing something where 0 has a real meaning (such as "number of units in stock"), then there is no problem using 0. However, you're using 0 inconsistently here. Given your description, a lower number is more desirable, where 2 is better than 15, so 0 should be better than 1. Clearly it isn't, and so you should rethink your system. You should avoid using 0 and instead use something that is more in keeping with its meaning. E.g. n/a, not found, or even a simple - would be better.

Granted, there are some technical challenges to including a non-numeric value in a value field, but that is an implementation question, not a UX one. However, if you have no power to change the display from a number to some more useful text, I would suggest using an high value to indicate a poor position, as it is then at least in keeping with your goal. So showing 9999 would better indicate a poor ranking than showing 0.

My strong preference would be for a text label of not found over a high number.

  • But if have multiple rows with value of 0 (or even 1 and 2), what order should 0 values appear here?
    – danielone
    Aug 9, 2016 at 1:30
  • @danielone if you are showing someone some numbers and sorting them, then they should be ordinally sorted. Your problem isn't a sorting order problem, but rather a poor choice by someone in what you use 0 for.
    – JohnGB
    Aug 10, 2016 at 8:08

To answer your question, because in your context 0 does not mean a better position than 1, then the 0 entries should be displayed after the last relevant entry (ranking > 0) when sorting ASC, and before them when sorting DESC.

If you can change the back-end, then either replace 0 with 9999 (or other relevant positive value), or add a new column or alter your db query with a formula so that you end up with a sorting 1..49, 50, 0 for ASC, or 0, 50, 49... 1 for DESC. The values that you're displaying do not have to be the same that you're using for sorting. You should also consider a second sorting criteria (such as alphanumerical sort by keyword), so that the order of all the 0 entries is consistent between page displays.

On the front-end, you could choose to replace the 0 with some other text.

The same applies for the "Previous" column.

Another option all-together would be to have two separate listings, one for keywords that match (rankings > 0) and another for keywords that do not match. But this way you might lose the ability to track the previous position compared with current results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.