Autofilter selects wrong range

I have a spreadsheet with a large table on which there is an autofilter defined.

I recently upgraded my OS to Ubuntu 24.04, and this brought with it LibreOffice 24.2.5.2.

I now find that when I try and use “sort ascending” on one column in my table, it includes rows outside the table in the sort.

If I turn off autofilter, it reacts as if I am turning on autofilter on the whole sheet. I have to turn it off again to get rid of it. I then select the table I am trying to work with, click autofilter. The extra rows are added as soon as I try and select a “sort” from one of the autofilter dropdowns. However, I cannot reproduce this bug in a clean spreadsheet.

I don’t know whether this is related to the autofilter having to ask me about header rows. All the examples I have tried in a clean spreadsheet have not needed to ask me, but simply found the header rows.

Is this a known bug? If so, which version do I need to cure it? (And I’ll be coming back with questions about how to update it…)

Please attach a sample file, reduce the size as much as possible without private information, and paste the information in Menu/Help/About LibreOffice, there is a copy icon.

Remove any filter.
Select the entire range of data, including the header row
Call Data>Define…
Give a name to the selected range.
Under the additional options check “Contains column labels”.
Click [Add]
Click [OK]
Try again to define your filter.

Remove any filter.

OK, clicking “autofilter” several times did this.

(The first time now adds an autofilter on the whole sheet, without removing the one that was already defined - something I hadn’t thought possible!)

Select the entire range of data, including the header row
Call Data>Define…
Give a name to the selected range.

OK.

Under the additional options check “Contains column labels”.

was already selected

Click [Add]
Click [OK]
Try again to define your filter.

OK, did that.

Then I chose “select range” from the Data menu.
I clicked the name I had given the range.
I then selected “Autofilter” from the data menu.

The list of possible values to filter on already included values from outside the range, and when I sorted, the range was right to the bottom of the sheet, not the range I had defined.

So this does not provide a work-around for this bug.

I am still working on preparing a minimal version. I can get so far, and the bug remains present, and then I reach a point where removing the autofilter and reinstating it (no defined names) restores correct operation. I have yet to discover exactly what change I make to achieve this, though. It isn’t the deletion of the two columns to the left of the one I’m sorting on. I think I’ve also confirmed that it isn’t the unfreezing of the panes.

When you click a grey column header (A,B,C,…) before sorting, you select the entire column of cells and sort that range. Click any single cell in the range to be sorted or filtered.

Yes, I’m aware of that. I’m not clicking the column header, I’m clicking the filter dropdown that appears in the header row (cells in the sheet, not the column header) when I apply an autofilter. The problem is that the range over which the autofilter operates extends itself - without being asked - to cells below the range on which I defined it.

Please bear in mind that this problem has appeared with the upgrade. It used to work correctly before.

Nobody can reproduce that. I’m using the same version.