I think I found a bug in LOOKUP

I don’t understand why :

=LOOKUP("A",{"A","B","C","D"},{1,2,3,4})

Works fine for search criteria = “A”,“B”,“C” or “D”
However

=LOOKUP("Mineur",{"Mineur","Majeur","Grave","Catastrophique"},{1,2,3,4})

Works for search criterion “Mineur” and “Majeur” but gives #N/A for “Grave” and “Catastrophique”

I think this is a bug but I’m open for all other suggestions

I’m using :

Version: 7.5.1.2 (X86_64) / LibreOffice Community
Build ID: fcbaee479e84c6cd81291587d2ee68cba099e129
CPU threads: 8; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

Jouke

Hallo

in your first Example the lookup-list is sorted ascending ( as required by LOOKUP ) … but not in your second Example!

Welcome! Yes, this is a mistake. But not a function error, but a user error: please do not ignore this function feature
image

1 Like

Your key vector is sorted backwards. You need to specify third parameter zero to work “unsorted” or arrange the sequence exactly opposite of what you have.
(Edited, thanks @JohnSUN for spotting my mistake.)

Perfect ! That was the problem. Sorry for noise !!