Ask Your Question
0

Calc -lookup gives wrong answer

asked 2012-05-06 00:57:11 +0200

MrHuge gravatar image MrHuge
1 1 1

updated 2013-03-01 06:09:30 +0200

qubit gravatar image qubit flag of United States
5721 3 48 41

I have a sheet to record results from Grand Prix races, I use the LARGE function to sort out the points won, to list the top three point scorers. B24 =LARGE(C21:X21,1), B25=LARGE(C21:X21,2), B26 =LARGE(C21:X21,3). This shows the correct results. I then use the lookup function to show the name of the driver associated to these scores. C24 =LOOKUP(B24,C21:X21,C1:X1), C25 =LOOKUP(B25,C21:X21,C1:X1), C26 =LOOKUP(B26,C21:X21,C1:X1). The first and second scores show the correct drivers name but the third score shows an incorrect driver name for the correct score, (gives the fourth drivers name). If I contine to the fourth and fifth top scores it shows the correct driver name but the sixth shows the error #N/A. Any suggestions as to what I am doing wrong, or is this a bug?

Thanks MrHuge

delete close flag offensive retag edit

3 Answers

Sort by » oldest newest most voted
0

answered 2012-11-08 15:49:33 +0200

Jakub Narębski gravatar image Jakub Narębski
1

I wonder why HLOOKUP and VLOOKUP have an option to use unsorted keys, while LOOKUP doesn't support it.

What is strange that whether the problem described happens or not might depend on if source is in different spreadsheet.

link delete flag offensive edit
0

answered 2012-05-06 01:49:07 +0200

mariosv gravatar image mariosv flag of Spain
4749 20 46

Form built-ín help:

LOOKUP Returns the contents of a cell either from a one-row or one-column range. Optionally, the assigned value (of the same index) is returned in a different column and row. As opposed to VLOOKUP and HLOOKUP, search and result vector may be at different positions; they do not have to be adjacent. Additionally, the search vector for the LOOKUP must be sorted ascending, otherwise the search will not return any usable results.

If LOOKUP cannot find the search criterion, it matches the largest value in the search vector that is less than or equal to the search criterion.

link delete flag offensive edit
0

answered 2012-05-06 01:54:07 +0200

Pedro gravatar image Pedro flag of Portugal
3218 4 23 54

It is not a bug. The Lookup function only works if the primary key (the first column) is sorted in ascending order (sometimes it works, I have no idea why, in unsorted lists and that is what causes confusion)

If you sort your scores and drivers list in ascending order of the scores the Lookup function will work as expected

link delete flag offensive edit

Login/Signup to Answer

Donate

LibreOffice is made available by volunteers around the globe, backed by a charitable Foundation. Please support our efforts: Your donation helps us to deliver a better product!

Question tools

Follow

subscribe to rss feed

Stats

Asked: 2012-05-06 00:57:11 +0200

Seen: 427 times

Last updated: Nov 08 '12