Calc: cells excluded from sort

In the attached *.ods file, cells in column C (= seqpre) contain a header and the digits 1, 2, and 3. I need Calc to sort column C. These are the Sort Criteria:

Options:
Case sensitive ON
Enable natural sort ON

The result is that column C sorts correctly except for the last 2 cells (# 1882 and 1883). Can anybody tell me what to do to have Calc include the last 2 cells in its sort as well?
sortprob.ods (26.6 KB)

Version: 25.2.4.3 (X86_64) / LibreOffice Community
Build ID: 33e196637044ead23f5c3226cde09b47731f7e27
CPU threads: 4; OS: macOS 12.7.6; UI render: Skia/Raster; VCL: osx
Locale: en-GB (en_GB.UTF-8); UI: en-US
Calc: threaded

Ask/Guide - How to use the Ask site - The Document Foundation Wiki #More_details


no problem with
Version: 24.8.7.2 (X86_64) / LibreOffice Community
Build ID: 480(Build:2)
CPU threads: 4; OS: Linux 6.11; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Ubuntu package version: 4:24.8.7-0ubuntu0.24.10.1
Calc: threaded
image

You somehow forgot to tell how you start sorting, which is: “I have some single cell focused in the area, when I start the dialog - i.e., I don’t select my data manually, neither A1:CC1883, nor whole columns A:C; and I rely on Calc to find the area itself, even though my cells A1882 and A1883 are empty, so the rectangular block is broken”.

I would report that problem as a bug: empty cells in the first column are OK in the middle, but not in the end, even though the other columns allow to deduce the correct rectangle.

If you already have AutoFilter enabled, why not use its own sorting?
image

If you want to use the standard sorting, then disable AutoFilter (Ctrl+Shift+L), sort the ranges (Ctrl+A) and enable AutoFilter again. If I were Calc, I would be confused too.

Done, thanks.

This works, thank you! – I noticed that once all the cells are selected (Cmd+A), AutoFilter is turned off automatically, and the sorting works as expected. (Originally I didn’t use Cmd+A before sorting.)

(Using AutoFilter’s own sorting only works if I don’t need other columns to be sorted as well.)

tdf#167173

The problem with your document is database range “loc_line”. It does not cover the last two rows, which is why they remain unsorted.

1 Like

You are correct in that the last two cells in column A are empty (as are a few other cells in column A).

However, with this file, as a user I was interested only in the correct sorting of column C. That it was sorted incorrectly, so to speak – even though its last two cells are non-empty – caused lots of head-scratching.

Database range loc_line refers to A1:CC1881. This is the sort range.
Your data reach until row 1883.

I can’t remember ever having defined a database range in this file. Where did you find it?

menu:Data>Define…
There are 57 of them.

1 Like