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

--- Comment #3 from Regina Henschel <[email protected]> ---
I have begun investigating the cause. However, I do not have a solution. To
ensure that the results are not lost, here is a report:

Let's look at an example with values
A1=1, B1=2, C1=3
A2=CELL(“ADDRESS”;XLOOKUP(;A1:F1;A1:F1))
and an otherwise empty sheet.
Cell A2 should display the string “$D$1.” Excel does this, by the way.

The problem becomes clear in
https://opengrok.libreoffice.org/xref/core/sc/source/core/data/queryiter.cxx
in lines
#131   if (nCol > maParam.nCol2 || nCol >=
rDoc.maTabs[nTab]->GetAllocatedColumnsCount())
#132       return;
GetAllocatedColumnsCount() has the value 3 here. As a result, cell D1 is not
considered at all, even though it belongs to the search vector.

You cannot simply replace >= with >. In line
145                  pCol = &(rDoc.maTabs[nTab])->aCol[nCol];
the vector aCol (a ScColContainer) actually only has 3 elements, and a aCol[3]
would then cause an “Expression: vector subscript out of range” assertion
failure.

This vector aCol has already been determined somewhere before the function
call. I see the value in ScInterpreter::ScXLookup() in
this.mrDoc.maTabs[0]->aCol. I don't know where aCol is calculated. It contains
the columns that are actually used. This is certainly necessary in other places
for performance reasons.

If cell D1 contains a comment or an image, it is still empty, but the vector
aCol then has 4 elements and the empty cell in the search vector is found. It
is also found if the sheet contains a value somewhere in a higher column.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to