Issue 11145 - empty cells not considered in sort / cannot change order
Summary: empty cells not considered in sort / cannot change order
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOo 1.0.1
Hardware: PC Other OS
: P3 Trivial with 2 votes (vote)
Target Milestone: ---
Assignee: oc
QA Contact: issues@sc
Depends on:
Reported: 2003-02-03 07:19 UTC by mortoray
Modified: 2007-10-26 06:11 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

Simple sheet with data noted in description (5.01 KB, application/octet-stream)
2003-02-03 07:20 UTC, mortoray
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description mortoray 2003-02-03 07:19:16 UTC
Possibly related issues: 6783, 10068

Empty cells don't seem to play a role in sorting of the spreadsheet data, which means they cannot be sorted in a particular direction.

If you create a simple sheet with these values

If you sort on Column A ascending, then Column B ascending you get the same results as Column B descending.  That is, the ordering on Column B seems to exclude blank spaces from the ordering, choosing to always put them last.

The expected behaviour is that the choice to put empty items first or last is dependent on the choice of ascending or descending sort on Column B.
Comment 1 mortoray 2003-02-03 07:20:05 UTC
Created attachment 4539 [details]
Simple sheet with data noted in description
Comment 2 frank 2003-08-15 13:27:04 UTC
It's not a bug.

Cell B1 contains nothing and *not* a space. So sorting first on column
A and then on B results in One,+ and then One as there is nothing to
sort in column B for the lonely One entry.

So it works as defined and therefore this Issue has to be closed as

Comment 3 frank 2003-08-15 13:27:19 UTC
closed invalid
Comment 4 mortoray 2003-08-16 14:23:13 UTC
My choice of the phrase "blank spaces" may have been misleading.  I
understand the cell is "empty", but it should still play a role in the

When choosing ascending these "empty" cells are placed last in the
order, thus it only makes sense that choosing descending places them
"first" in the order...?
Comment 5 frank 2003-08-19 10:43:51 UTC

if you have a blank cell which means there is nothing in it, the state
of this cell for sorting is undefined. So undefined specimen will
always be sorted at the end of the list. I think this is common use
and therefore Ok.

Comment 6 aboba 2007-10-26 06:11:13 UTC
Don't know if commenting/voting on a closed issue will have any effect however,
here goes.

fst says null cell has nothing to sort so isn't sorted, appears last. I would
say before there can be anything there is nothing. From sort order perspective
nothing should therefore preceed any value.

From a practical point of view there are instances where users would want to
sort nulls first. e.g. sheet with columns 'date created', 'date resolved',
'action requested'

If user wishes to keep unresolved requests at top of sheet by ordering on 'date
resolved'+'date created'+'action requested' it doesn't work. For most users it
would be natural to want to order rows like this. Problem can be defeated with
non-intuitive step of putting a space in 'date resolved' column. That though
makes the worksheet very hard to maintain because it isn't possible to determine
if cell has space entered or is null just by looking at it. Plus user must
remember to put spaces in otherwise empty cells to make sort occur in desired

My votes are for nulls to be sorted either before or after other values based on
a global setting in tools|options. They are already sorted after this would
enable the option of sorting them before as well.