Bug 93305 - vlookup comparison operator confused by strings containing parentheses
Summary: vlookup comparison operator confused by strings containing parentheses
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-09 18:00 UTC by Ivor O'Connor
Modified: 2015-12-04 09:17 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
example of vlookup being confused when comparison string contains parentheses. (14.95 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-08-09 18:00 UTC, Ivor O'Connor
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivor O'Connor 2015-08-09 18:00:24 UTC
Created attachment 117794 [details]
example of vlookup being confused when comparison string contains parentheses.

Strings like "16GB (2x8GB) 1600MHz DDR3L [add $112.00]" confuse vlookup.

The above string is used in the description of a product and so I copied it into one column and put the price in the next column. In another sheet one column is validated to contain the values from the above column. Using vlookup it should put the price next to it. However the vlookup does not find the description if it contains a parentheses like in the "(2x8GB)" above.

I've attached a file showing the problem.
Comment 1 m_a_riosv 2015-08-09 21:20:51 UTC
Hi @Ivor, thanks for reporting.

But the issue it's simple.

Parentheses are part of the regular expression, which are used by VLOOKUP().
You have the option to disable regular expressions for the file in:
Menu/Tools/Options/LibreOffice calc/Calculate - Enable regular expressions in formulas.
Then seems it works fine.

If you want to use regular expression, then special characters for them must be scaped with backslash, e.g. \( and \)

https://wiki.documentfoundation.org/Documentation/How_Tos/Regular_Expressions_in_Calc
Comment 2 Ivor O'Connor 2015-08-09 21:28:04 UTC
Thanks. That fixed it. It seems most people would not want tricky regular expressions to interfere. And if they are advanced enough to know about them then they could turn it on. However the spreadsheet now works as expected. Thank you.
Comment 3 m_a_riosv 2015-08-09 21:31:42 UTC
Thank you for confirmation.
Comment 4 Antonello 2015-12-04 09:09:35 UTC
I leave this bug as resolved, but I strongly support that vlookup does NOT use regex by default.. I also understand that's a difficult decision to make at this point of the project release..
Comment 5 m_a_riosv 2015-12-04 09:17:45 UTC
Then please report a new bug as request for enhancement.