![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
Can I use vlookup with dublicate records?
ex. ColumnA ColumnB 1 tom 2 steve 3 mike 3 joe How can I vlookup 3 and return joe? Any help would be great. I am new to excel. Thank you |
|
|
|
#2 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi
If you only have 3 once, use: =VLOOKUP(3,A1:B10,1,FALSE) The False agument will mean it finds an exact match. |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 24
|
Thanks Dave
But I have 3 more than once. Was wondering if there is something I could do to find the 2nd 3. Thanks |
|
|
|
|
|
#4 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Ok then, as you are new to Excel I wont confuse the issue with a horribly long function, try this instead.
Lets' assume your numeric data you want to lookup in in Column A. Insert a new column at Column A so that the data is now Column B. Now in Cell A2 put this: =IF(COUNTIF($A$1:A1,B2)=0,B2,"") Note the absolution of $A$1 Copy this down as far as needed then use the VLOOKUP to look for the number you want in Column A eg: =VLOOKUP(3,A1:C100,3,FALSE) |
|
|
|
|
|
#5 |
|
New Member
Join Date: Mar 2002
Posts: 24
|
Dave,
Again thanks for the help. Thats seems to find the 2nd one but i also need the first. I need to be able to vlookup but 3's with the different name attached. ex. ColumnA ColumnB 1 tom 2 steve 3 mike 3 joe need to vlookup 1st 3 with mike and 2nd 3 with joe. sorry if I wasn't that clear am new at this also. Thanks again DaBoyz1971 |
|
|
|
|
|
#6 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi
Try this link to my site, it has a Custom type vlookup that let's you nominate which istance to return. http://www.ozgrid.com/VBA/TwoColLkUp.htm |
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
As is clear from the exchanges in this thread, you want to retrieve "joe" also when the lookup/key value is 3.
Note 1. It is better, if possible, not to associate the same key value with different values. Assuming that A2:B5 houses your sample data: In D1 enter: 3 [ a lookup/key value ] In D2 enter: =IF(COUNTIF(A:A,$D$1)>0,VLOOKUP($D$1,$A$2:$B$5,2,0),"Not Found") In D3 enter: =IF(COUNTIF(A:A,$D$1)>COUNTA($D$2:D2),VLOOKUP($D$1,$B$5:INDIRECT("A"&MATCH($D2,$B$1:$B$5,0)+1),2,0),"") and copy down this till no more values are returned. Note 2. If your data area is frequently changing (that is, the area is dynamic), a different approach might be more appropriate. Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|