lookup or vlookup

J

jamalhakem

Hi
I have this worksheet

25 apple
15 banana
30 cucumber
5 tomato

If I use vlookup or lookup function, the data should be sorted, the
default of these functions is ascending or descending, but I do not
want to sort the data, any help?
Thanks in advance
Jam
 
E

exoticdisease

vlookup should be fine. Let's assume you wanted to return cucumber you could
do:

=vlookup(30,a1:b4,2,)

Should search for 30 in the array of a1:b4 (which is all of your data), go
to the second column and return the data in the same row as 30. It should
give you cucumber. Only specific sorts of vlookup require the data to be
sorted.

Rob
 
M

Max

Think your
=vlookup(30,a1:b4,2,)

should read as:
=vlookup(30,a1:b4,2,0)
where an exact match is specified via the zero* as the 4th param
*or FALSE

As for your comment:
Only specific sorts of vlookup require the data to be sorted.

It should be the other way around, specific match in vlookup (as above)
doesn't require the data to be sorted
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:16,200 Files:354 Subscribers:53
xdemechanik
---
 
T

Teethless mama

"exoticdisease" has a right syntax. The last comma after the third param is
automatic default to "0" or "FALSE" if the fourth param is omitted.
 
T

Teethless mama

Without the last comma in the third param then it defaults to 1 or TRUE, else
it defaults to 0 or FALSE.
 
P

Peo Sjoblom

I didn't notice that it was a comma, nevertheless it is hard to call it the
right syntax since it is undocumented and probably somewhat of a bug as
well.

--


Regards,


Peo Sjoblom
 
M

Max

TM, thanks

But on the basis of exoticdisease's clarifying comment:
Only specific sorts of vlookup require the data to be sorted.

I'm not sure that s/he understands what is really happening
with the type of vlookup construct that s/he uses
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:16,300 Files:356 Subscribers:53
xdemechanik
---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top