Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / July 2006

Tip: Looking for answers? Try searching our database.

KBV- vlookup question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
KBV - 11 Jul 2006 03:23 GMT
In the vlookup formula, the range entered includes the columns that need to
be searched for matching or similar values and the range also includes the
column from which the corresponding value has to be returned. What if there
are 2 or more columns within that range that match the lookup value? How does
excel handle that?
Ryan Christiansen - 11 Jul 2006 03:51 GMT
According to Help for Excel 2003, VLOOKUP "searches for a value in the
first column of a table array." It only searches in that column for the
lookup_value argument.

-Ryan

> In the vlookup formula, the range entered includes the columns that need to
> be searched for matching or similar values and the range also includes the
> column from which the corresponding value has to be returned. What if there
> are 2 or more columns within that range that match the lookup value? How does
> excel handle that?
Bob Phillips - 11 Jul 2006 08:33 GMT
=INDEX(rng_result,MATCH(1,(rng_lookup_1=value1)*(rng_lookup_2=val2),0))

which is an array formula, it should be committed with Ctrl-Shift-Enter, not
just Enter.

If the value to be tested against is a string, enclose in quotes, or store
in a cell and refer to the cell.

Signature

HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

> In the vlookup formula, the range entered includes the columns that need to
> be searched for matching or similar values and the range also includes the
> column from which the corresponding value has to be returned. What if there
> are 2 or more columns within that range that match the lookup value? How does
> excel handle that?
KBV - 15 Jul 2006 13:15 GMT
I'm new to vlookup and am only familiar with the standard/basic vlookup
formula. Can you explain what the formula you wrote below means?

Thank you

> =INDEX(rng_result,MATCH(1,(rng_lookup_1=value1)*(rng_lookup_2=val2),0))
>
[quoted text clipped - 12 lines]
> does
> > excel handle that?
Dave Peterson - 15 Jul 2006 15:57 GMT
Since you entered this as an array formula, excel will do essentially "for each
cell in this range, do something" comparisons.

rng_lookup_1=value1
will return an array of true/falses depending on whether each cell matches that
value1.

The same thing will occur for each cell in rng_lookup_2 compared to val2.

So you're left with an array of true/falses multiplied by another array of true
falses:

{true, false, true, false, true}*{false, true, true, true, true}
for example.

When excel multiplies booleans, it'll result in an array of 1's and 0's.

In my example:
{0,0,1,0,1}
(true * true = 1, false * anything = 0)

=match(1,{array of 0's and 1's},0)
will return the first position in that array that matches 1 which means it
returns the first position that matches value1 and val2.

=index(rng_result,somenumber)
will result in the somenumber-eth element of that rng_result range.

Simple as pie, huh?

But very powerful.

> I'm new to vlookup and am only familiar with the standard/basic vlookup
> formula. Can you explain what the formula you wrote below means?
[quoted text clipped - 24 lines]
> > does
> > > excel handle that?

Signature

Dave Peterson


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.