Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default vlookup with 2 results the same

I have a list of values where some are the same. How can I use vlookup and
have it give me the result instead of coming up with error?

eg:
i want to lookup 4788000 and have give me the results from list 3 ie 21,31
4332000 39 21
4788000 76 45
3990001 65 45
3420001 74 45
4560000 74 40
3192001 87 49
7410001 59 31
5472001 56 32
5700001 69 36
4788000 54 31

Can I also have it lookup as above but give me the result according the
number in column 2? ie give the result 21,31 or 31,21?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default vlookup with 2 results the same

Hi,

VLOOKUP doesn't return an error if there are 2 matches so to lookup and
return from column 2 use

=VLOOKUP(D1,A1:C10,2,FALSE)

or to return column 3

=VLOOKUP(D1,A1:C10,3,FALSE)

Where the value you are looking up is in D1

If there are 2 (or more) matches and you want them all try this ARRAY
formula. see below on how to enter an array formula. The formula returns the
first match from column2 drag down for the second match.

To return the value from column 3, change $B$1:$B$20 to $C$1:$C$20

=INDEX($B$1:$B$20,SMALL(IF($A$1:$A$20=$D$1,ROW($A$ 1:$A$20)-ROW($E$1)+1),ROWS(B$1:B1)))

This is an array formula which must be entered by pressing CTRL+Shift+Enter
'and not just Enter. If you do it correctly then Excel will put curly brackets
'around the formula {}. You can't type these yourself. If you edit the formula
'you must enter it again with CTRL+Shift+Enter.

Mike



"wildecoyote" wrote:

I have a list of values where some are the same. How can I use vlookup and
have it give me the result instead of coming up with error?

eg:
i want to lookup 4788000 and have give me the results from list 3 ie 21,31
4332000 39 21
4788000 76 45
3990001 65 45
3420001 74 45
4560000 74 40
3192001 87 49
7410001 59 31
5472001 56 32
5700001 69 36
4788000 54 31

Can I also have it lookup as above but give me the result according the
number in column 2? ie give the result 21,31 or 31,21?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,836
Default vlookup with 2 results the same

Wait, aren't you looking for results of 45 and 31? With your data in 3
columns (A, B, and C), and the number 4788000 in cell E1, enter this formula
in cell F1:
=IF(ROWS(C$1:C1)<=COUNTIF($A$1:$A$20,$E$1),INDEX($ C$1:$C$20,SMALL(IF($A$1:$A$20=$E$1,ROW($A$1:$A$20)-ROW($E$1)+1),ROWS(C$1:C1))),"")

Enter it with Ctrl+Shift+Enter (all three together; not just Enter). Fill
down... Does that do what you want?

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Mike H" wrote:

Hi,

VLOOKUP doesn't return an error if there are 2 matches so to lookup and
return from column 2 use

=VLOOKUP(D1,A1:C10,2,FALSE)

or to return column 3

=VLOOKUP(D1,A1:C10,3,FALSE)

Where the value you are looking up is in D1

If there are 2 (or more) matches and you want them all try this ARRAY
formula. see below on how to enter an array formula. The formula returns the
first match from column2 drag down for the second match.

To return the value from column 3, change $B$1:$B$20 to $C$1:$C$20

=INDEX($B$1:$B$20,SMALL(IF($A$1:$A$20=$D$1,ROW($A$ 1:$A$20)-ROW($E$1)+1),ROWS(B$1:B1)))

This is an array formula which must be entered by pressing CTRL+Shift+Enter
'and not just Enter. If you do it correctly then Excel will put curly brackets
'around the formula {}. You can't type these yourself. If you edit the formula
'you must enter it again with CTRL+Shift+Enter.

Mike



"wildecoyote" wrote:

I have a list of values where some are the same. How can I use vlookup and
have it give me the result instead of coming up with error?

eg:
i want to lookup 4788000 and have give me the results from list 3 ie 21,31
4332000 39 21
4788000 76 45
3990001 65 45
3420001 74 45
4560000 74 40
3192001 87 49
7410001 59 31
5472001 56 32
5700001 69 36
4788000 54 31

Can I also have it lookup as above but give me the result according the
number in column 2? ie give the result 21,31 or 31,21?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default vlookup with 2 results the same

Hi,

You may refer to my article here
http://office.microsoft.com/en-us/ex...260381033.aspx

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"wildecoyote" wrote in message
...
I have a list of values where some are the same. How can I use vlookup and
have it give me the result instead of coming up with error?

eg:
i want to lookup 4788000 and have give me the results from list 3 ie 21,31
4332000 39 21
4788000 76 45
3990001 65 45
3420001 74 45
4560000 74 40
3192001 87 49
7410001 59 31
5472001 56 32
5700001 69 36
4788000 54 31

Can I also have it lookup as above but give me the result according the
number in column 2? ie give the result 21,31 or 31,21?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum the results of a vlookup Gino59 Excel Worksheet Functions 3 July 31st 09 02:52 PM
IF/VLOOKUP with #N/A results Supe Excel Discussion (Misc queries) 6 July 2nd 09 09:30 PM
Vlookup with two results Luke Excel Discussion (Misc queries) 2 March 22nd 07 05:41 PM
to sum up all value results from VLOOKUP Linn Excel Worksheet Functions 1 March 7th 07 02:45 AM
how do you add vlookup results? Anna Excel Worksheet Functions 3 March 26th 05 03:05 AM


All times are GMT +1. The time now is 06:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"