Bug 142538 - EDITING: VLOOKUP function doesn't handle matches with "(", ")" and "/" characters properly
Summary: EDITING: VLOOKUP function doesn't handle matches with "(", ")" and "/" charac...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.1.3.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-28 10:05 UTC by Simon Werner
Modified: 2021-05-28 10:49 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Example of VLOOKUP bug (10.01 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-05-28 10:05 UTC, Simon Werner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Werner 2021-05-28 10:05:58 UTC
Created attachment 172402 [details]
Example of VLOOKUP bug

The VLOOKUP behaves incorrectly in v7.1.3.2.  If you are looking up the value "d (e)" in a column, it will not match a cell with the same value.

For example, if you are looking up "d (e)" using '=VLOOKUP("d (e)",A:A,1,FALSE)' in a column with the following values:
"a"
"b"
"c"
"d e"
"d (e"
"d (e)"

it will match on "d e", this in correct, it should match "d (e)".

This behaviour is different this version that old versions of LibreOffice Calc, it is also different from Excel.

This occurs on Ubuntu 21.04 with the default LibreOffice 7.1.3.2 installed.  Attached is an example spreadsheet.
Comment 1 Mike Kaganski 2021-05-28 10:49:16 UTC
This is not a bug.

As mentioned in VLOOKUP help [1], it supports wildcards or regular expressions. The parentheses are special characters in regular expressions [2] (capturing parentheses), and thus, when regular expressions are enabled for a spreadsheet (as is in your sample), treated specially (i.e., "d (e" is an invalid regex, and "d (e)" matches "d e" and captures "e" in the matched text).

> This behaviour is different this version that old versions of LibreOffice Calc

No. I have checked with LO 6.0.0.3, 5.0.0.5, 4.0.0.3, and 3.3.0.4, as well as with OOo 3.3.0. They all work identically with your sample.

> it is also different from Excel.

Indeed, because Excel does not support regular expressions in formulas. That's why in LO 5.2 support for wildcards (a simple matching syntax used by Excel) was added [3], and in LO 5.3, it was made the default [4].

Maybe your confusion about previous LO versions behaving differently was caused by working with spreadsheets created in later versions, or with XLS(X), while now you have opened a file with regex enabled? Or if you are sure that some older version actually worked differently (which would be a bug in that older version), you may post this information here.

[1] https://help.libreoffice.org/latest/en-US/text/scalc/01/04060109.html?DbPAR=CALC#bm_id3153152
[2] https://unicode-org.github.io/icu/userguide/strings/regexp.html#regular-expression-operators
[3] https://wiki.documentfoundation.org/ReleaseNotes/5.2#Support_wildcards_to_be_compatible_with_XLS.2FXLSX_and_with_ODF_1.2
[4] https://wiki.documentfoundation.org/ReleaseNotes/5.3#Option_settings