Sort Ascending button in Calc sorts column labels with data

This appears to be an old issue, but has not been resolved as of v. 6.3.4.2. I have to go to Data>Sort>Options, check the “Range contains column labels” box, then go to “Sort Criteria” and select the key I want to sort on, Ascending (or Descending), then “OK”.

But Calc doesn’t remember the “Range contains column labels” selection and the process must be repeated with every sort.

An answer to this question back in May of '18 included the statement “Column headers don’t get sorted. Calc knows not to include these.” Well, that may have been the case then, but does not appear to be the case now.

Appreciate any help!

Jim

Can’t confirm your statement - if I select a range containing column labels, my LibreOffice 6.3.4.2 automatically recognizes the label line and no need to set the respective option. The problem only appears, if the label line is not the first line of the selected range to be sorted.

IIRC, LO detects the column headers by text vs numbers - but if both are numbers or both texts, detection will fail.

@mikekaganski - hmm; made a test since assuming some restriction of the detection algorithm like the one you mentioned - thus named headers Label 1 … through Label 10 and filled 10x30 matrix using text Data ## (## some arbitrary integers) and that worked for me (but may be I did it wrong) - checked with numbers only => you are right.

To get calc remembering the options, you need to assign a range name in Menu/Data/Define range

Thanks to all for the quick responses! Opaque, maybe I am not attempting a sort correctly. You say “If I select a range containing column labels…” I am under the impression the right way to sort was to select the column label on which you want to sort. If for example I select the label “Last Name” and hit the “Sort Ascending” button I would expect all my data to be arranged by last name. It certainly works that way when I use the Data>Sort procedure. And yes, my column labels are on the first line.

Mike, I seem to have this problem whether the labels are text or numbers, and whether the data in the columns are text or numbers.

m.a.riosv, I tried your suggestion and it did not solve my issue.

Jim

Just wanted to reiterate one possible answer to this problem: I had a sheet where some of the headers were text and some were numbers, and Calc would forget every time I went to sort it that there was a header row. I added a single letter to each of the headers that previously only had numbers, and like magic it now properly auto-detects the header row.

TL;DR - make sure all headers are strings, not just numbers, to ensure your header row is properly detected.

I wanted to upvote davidwizard’s comment but I need 5 reputation points, sigh…
Absolutely - one of my columns was actually a formula total. Lots of frustration as per above, defining data ranges, ticking “Range contains column labels”…
Then I read his comment, changed that field to a text field and hey presto - now it recognises the header always.