简体   繁体   中英

LOOKUP function not giving expected results

I am having a problem with the LOOKUP function.

To test some things, I entered the following function

=LOOKUP(4.19, $B$2:$B$6, $C$2:$C$6) 

And on every line, it gives me a different answer. I don't know what is the problem with it because it just gives me the wrong answer. It should say "blue".

给出的例子

With LOOKUP the values you are searching in must be in descending order. If you want to keep the order as is, you might want to use INDEX/MATCH functions .

The lookup value must be (always) in the first column of the lookup table. So, if you are looking for 4.19 (which is in the right-most-column) in order to return a value from a column further to the left then you'll have to change to INDEX/MATCH like so:

=Index($C$2:$C$6,Match(4.19, $B$2:$B$6,0))

With the third argument you tell the function what the output should be if the first argument( 4.19) is valid. since you enterd a range of cells, the output differs. Also if you are searching for an exact value you should add a further argument at the end of the function =VLOOKUP(4.19, $B$2:$B$6, D1, FALSE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM