| Summary: | HLOOKUP not working when (..) in lookup field | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Olaf <documentfoundation> |
| Component: | Calc | Assignee: | Not Assigned <libreoffice-bugs> |
| Status: | CLOSED NOTABUG | ||
| Severity: | normal | ||
| Priority: | medium | ||
| Version: | 7.1.2.2 release | ||
| Hardware: | All | ||
| OS: | Windows (All) | ||
| Whiteboard: | |||
| Crash report or crash signature: | Regression By: | ||
| Attachments: | file with example | ||
|
Description
Olaf
2021-04-29 16:01:08 UTC
Created attachment 171509 [details]
file with example
This is not a bug. As described in HLOOKUP documentation [1]: > The search supports wildcards or regular expressions. With regular > expressions enabled, you can enter "all.*", for example to find the first > location of "all" followed by any characters. If you want to search for a > text that is also a regular expression, you must either precede every > character with a "\" character, or enclose the text into \Q...\E. You can > switch the automatic evaluation of wildcards or regular expression on and > off in Tools - Options - LibreOffice Calc - Calculate. The parentheses (and many other elements) are parts of Regular Expression syntax [2], and since your document has regular expressions enabled, the parentheses are considered capturing elements of regular expression, not literal search characters. Make sure to not use regular expressions in formulas, or to properly mask the strings that should not be treated as regular expressions, as described in the help. [1] https://help.libreoffice.org/7.1/en-US/text/scalc/01/04060109.html?DbPAR=CALC#bm_id3151001 [2] https://unicode-org.github.io/icu/userguide/strings/regexp.html As I had this ready in the edit buffer anyway..
Either disable regular expressions under Tools -> Options -> Calc -> Calculate (set to Wildcards for Excel compatibility, or no wildcards or regular expressions at all), or if you want to keep them enabled to be active for other expressions enclose the search text in \Q...\E to force literals, in your case
=HLOOKUP("\Q"& $J$9 &"\E";...)
(you could omit the closing "\E" in this case where it is the very last switching quoted literals off).
|