[Solved] Lookup error with unsorted lists

Discuss the spreadsheet application
Post Reply
Dean Hawes
Posts: 12
Joined: Mon Jun 18, 2012 5:56 pm

[Solved] Lookup error with unsorted lists

Post by Dean Hawes »

Hello all.

I hate to ask this often repeated question as I know it has been addressed in many guises.
I have tried the Match/Index work around with no success, and many other ideas.

The attached cacl file has multiple attempts already in the cells.
We are looking at the 'Product Printer' Page with reference to Cells D9 & D18 for example.

Basically I am trying to extract data to this page so I can print out BOM's for each product.

The 'Lookup' formula works only for the first product due to 'SORTING' issues but as soon as I select any other product it goes pear shaped.

I appreciate any input on this one as always.

best wishes
Dean.H
Attachments
2012 Nomad Products v14.ods
(114.29 KiB) Downloaded 199 times
Last edited by thomasjk on Sun Jul 22, 2012 8:46 pm, edited 1 time in total.
Reason: Mark thread [Solved] and add green checkmark
OpenOffice 3.3 on Win7
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Lookup error with unsorted lists

Post by Villeroy »

A spreadsheet is not a database and all the lookup functions are designed for a different purpose. You must not use LOOKUP when misusing a spreadsheet as database. You've got to use VLOOKUP with zero as 4th argument.
Then you should turn off the regular expressions in Tools>Options>Calc>Calculation and turn on the "match whole cells" option.
[Tutorial] VLOOKUP questions and answers
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
fst
Volunteer
Posts: 152
Joined: Wed Nov 28, 2007 2:31 pm

Re: Lookup error with unsorted lists

Post by fst »

Hi,

this is an extract from the help file about LOOKUP:

Additionally, the search vector for the LOOKUP must be sorted ascending, otherwise the search will not return any usable results.

So your problem is just the unsorted search vector. Correct it and it will work.

Frank
Frank

If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Lookup error with unsorted lists

Post by Villeroy »

fst wrote:Hi,

this is an extract from the help file about LOOKUP:

Additionally, the search vector for the LOOKUP must be sorted ascending, otherwise the search will not return any usable results.

So your problem is just the unsorted search vector. Correct it and it will work.

Frank
No, it won't work because it returns false positives for *any* value >= the first one.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Dean Hawes
Posts: 12
Joined: Mon Jun 18, 2012 5:56 pm

Re: Lookup error with unsorted lists

Post by Dean Hawes »

Ok, trying that now.

Do you mean turn on : 'Search criteria = and < > must apply to whole cell'

Cheers
OpenOffice 3.3 on Win7
Dean Hawes
Posts: 12
Joined: Mon Jun 18, 2012 5:56 pm

Re: Lookup error with unsorted lists

Post by Dean Hawes »

This list would be 2 complicated for user interpretation to have it sorted so its just not an option. But I have considered it.
OpenOffice 3.3 on Win7
Dean Hawes
Posts: 12
Joined: Mon Jun 18, 2012 5:56 pm

Re: Lookup error with unsorted lists

Post by Dean Hawes »

I have tried the VLOOKUP formula with 0 as the 4th argument and get a #VALUE error.

I have posted the changed CALC file for inspection.

Dean
Attachments
2012 Nomad Products v14.ods
(112.04 KiB) Downloaded 228 times
OpenOffice 3.3 on Win7
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Lookup error with unsorted lists

Post by Villeroy »

=VLOOKUP($D$5 ; $'INPUT PAGE'.$C$19:$AG$58 ; 31 ; 0)
looks up in C and returns the exactly matching value from the 31st column (AG) regardless of sort order.
Last edited by Villeroy on Sun Jul 22, 2012 5:52 pm, edited 1 time in total.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
JohnSUN-Pensioner
Volunteer
Posts: 876
Joined: Fri Jan 14, 2011 1:21 pm
Location: Kyiv, Ukraine

Re: Lookup error with unsorted lists

Post by JohnSUN-Pensioner »

D5 =VLOOKUP($D$5;'INPUT PAGE'.$C$19:$AG$58;24;0)
D18 =VLOOKUP($D$5;'INPUT PAGE'.$C$19:$AG$58;31;0)
I may not have a lot to give but what I got I'll give to you...
Apache OpenOffice 4.1.5, LibreOffice 6.4.4.2 (x64) on Windows 7
If you think that I did not answer your question, make allowances for my imperfect English
Dean Hawes
Posts: 12
Joined: Mon Jun 18, 2012 5:56 pm

Re: Lookup error with unsorted lists

Post by Dean Hawes »

[SOLVED]

Nice one gents.

I am not sure how this formula works but it does work and I really appreciate the help.

Cheers again.
Dean
OpenOffice 3.3 on Win7
User avatar
RoryOF
Moderator
Posts: 35070
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Lookup error with unsorted lists

Post by RoryOF »

The $ references are dealt with in
[Tutorial] Absolute, relative and mixed references
and Vlookup in
[Tutorial] VLOOKUP questions and answers

It is worth reading up on them, and asking further questions for clarification.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.5 LTS
Post Reply