Microsoft Excel - LOOKUP Function on Excel - why is it working sometimes and not others?

Asked By Colette Sanders on 04-Jun-15 10:42 AM

I've used the following formula to look up a category for a selection of different values:


=LOOKUP(Q6,'Dropdown boxes and lookup tabs'!$C$13:$D$23)


I know that I haven't input the values incorrectly as the cell I'm referencing (Q6 above) is from a dropdown list that uses the same cells as the lookup array, so there CAN'T be typos or whatever causing the difficulty. 


The formula is working for some cells but not for others.  There's no theme, ie it sometimes works for a cell that contains the text 'Expulsion' and sometimes doesn't. 


I've carefully examined the contents of each cell to see if the formula has changed in the copying but other than the reference cell, it doesn't.


Can anyone think of something that might be going wrong?


Thanks in advance for all suggestions. 


Just to add - I've just noticed it's actually returning the wrong values, for example it's looking up cell C16 and returning the value that's in cells D17 and D18 rather than the once in C16 that I want it to return.


STOP PRESS:  I seem to have sorted it by moving the lookup array into the first and second columns and sorting the first column by A-Z.  I don't really understand why that should've sorted it but it seems to have done - it would be useful if anyone could explain why that worked?

Harry Boughen replied to Colette Sanders on 04-Jun-15 05:59 PM
Hi Collette,
Good to see that you sorted it.  Just for your information the following is from the help on using LOOKUP.

Important The values in array must be placed in ascending order. For example, -2, -1, 0, 1, 2 or A-Z or FALSE, TRUE. If you do not do so, LOOKUP may not give the correct value. Uppercase and lowercase text are equivalent.

Regards

Harry
Harry Boughen replied to Colette Sanders on 04-Jun-15 07:29 PM
Hello again Colette,

Also forgot to mention that with LOOKUP it matches in the first column (or row depending on the shape of the array) and returns the corresponding value in the last column (or row) in the range specified.

That is why it was returning the value from columnD

Harry
Colette Sanders replied to Harry Boughen on 05-Jun-15 03:20 AM

Thanks Harry - it's useful to know that that is why it worked - I was worried it was going to go wrong again.  This is exactly the kind of thing I'll forget next time I use it! :-) 

But thanks for the information - much appreciated.