Set persistent option to include column headers when using data > sort

When sorting in calc, one must click the option “Range contains column headers” to treat the first row as, well, a header and not as part of the data.

Every time I do this, I wonder “can I set this option permanently?” I can’t recall the l last time I didn’t want this option. So, after years of this, I’m finally taking the time to ask. Can I permanently make this my default instead of having to click it each time?

Edit for clarity: I’m talking about a global, persistent, universal setting for this option. Not for a file or this file, but for all files I ever open. That box should default to being checked anywhere and always after I apply whatever magic you propose.

This is not solved. It is in fact the dreaded intermittent. Sometimes it works that an implicit range of contiguous data will be sorted as if its first row were the title columns and other times it will put the title row in the resulting sort. 148378 MUST BE REOPENED.

Data>Define…
Give a name to the range.
Check the column label option.
Click [Add], [OK]

And this works globally for all files? Maybe my question wasn’t clear: given any file I open, I always want that option checked. I’m interpreting your answer as working for the singular current file?

It should work for the defined range, so it has to be done only once. However, the quick sort buttons [A-Z] and [Z-A] do not obey defined database ranges.
The one and only solution for clean and easy sorting of record sets is a database. A spreadsheet is not a database.

P.S. and if I remember correctly, any complete top row of text (no numbers, no blanks) is recognized as a header row.

It should work for the defined range, so it has to be done only once.

To make sure I I follow, though, this is purely for the current file, right? I want this to work for all files. Essentially I just want to reverse the default LO Calc option (which is that that box is never checked).

Also, the current changing of that setting is also persistent for the current session/file. I want this setting persistent for all files for all time. I only want to have to un-check that option if I don’t want it, vs. having to take action every time I want to sort.

P.S. and if I remember correctly, any complete top row of text (no numbers, no blanks) is recognized as a header row.

Try it. I just did and I’m not finding this the case on 7.3.2.2. I created a new file and made this table:

grab_2022-04-04_151126

Ctrl+A, Data > Sort > Ok (mine defaulted to sort by Col C, but it doesn’t matter). I get this… I’ll have to put that in a new post as apparently I’m limited to one pic per post.

You can’t set this for all files unless you store your record sets in a database where they belong to.

You can click on any single cell within the column to be sorted by and then click a quick sort button. This will sort the current region of adjacent non-blank cells by the column where the cell cursor is in skipping any first row with text only.

After sorting:

grab_2022-04-04_151208

I requested this as a feature. I don’t know why it’s tied to whether or not the file is a database. Either way, I think you answered my question: this option and/or the possibility of setting it globally is not possible.

https://bugs.documentfoundation.org/show_bug.cgi?id=148378

Hit Ctrl+Shift+F4, browse Bibliography>Tables>biblio in order to see what a database table is. It has nothing to do with a spreadsheet. A database has true column labels on top of the actual table data. In a database every row is a unity that can’t be disrupted. A database table has a fixed amount of strictly typed columns (fields) and a variable amount of rows (records) with no empty ranges around data.
A spreadsheet is not a database. From the beginning it was intended as calculator on steroids but not as a database surrogate.

I am probably too much of a noob on these intricacies to understand why this information is relevant. I just want a global option for this checkbox. Not a workaround, or to understand features limited to dbs vs. spreadsheet, or to set per-file settings.

The question is purely “can I make that checkbox always checked by default, for all files for all sessions.” As I understand it, the answer is “No” so I have filed the feature request.

Do not use Ctrl+A, for which then of course the entire first row of the selection is not only text. Either select only the data range to be sorted, or just place the cell cursor somewhere within the data without selecting anything and the range will be selected upon invocation of Sort. And then the Range contains column labels is activated.

2 Likes

Because I never wanted to select all cells of a sheet, I changed Ctrl+A to “Select data area” which selects the current region of adjacent non-blank cells.

And LibreOffice changed the default behaviour. When I quick-sort a text only list in Apache OpenOffice, a header row is assumed.

Wow, I don’t even know why I do this… so (a) this is awesome and (b) sigh, years of clicking this option. I think I must have run into a partial selection at some point jumbling rows and just reflexively selected all forever more.

To clarify on this:

Do not use Ctrl+A, for which then of course the entire first row of the selection is not only text.

You’re saying that the empty cells in the first row to the right are what alters the sort behavior?

Yes.

1 Like

Clicking in only one cell does not solve it.

A competent development team would have fixed this long ago
… was the only comment I found by Bill Gates in the bug database at Microsoft while working there. Consider whether that might apply here.

This has been wasting large amounts of my time having failed to find a solution for months and making me almost hate LibreOffice. You don’t want that. Being liked is better for business.

I’ve been highlighting a column, then Data > Sort, and seemingly at random after Extend selection I’d have to click three more times to turn on Range contains column labels. Same if first clicking in just one cell.

To be loved, do the following instead:

  1. Move that option to the Sort Criteria tab/page. “Range contains column labels
  2. If Rows and Columns are frozen on row two, make it ON with one exception
  3. Override that with whatever the user last chose (persistent) with one further exception
  4. Provide an option on whether to keep last choice within Options > ... Calc > Defaults

Need this fixed once and for all. Roll up your sleeves, grit your teeth if necessary and just do it. Then we’ll all be having a nice day.