Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VPLookup Question 1

Status
Not open for further replies.

useractive

Programmer
Jun 21, 2001
98
US
Ok, I'm wanting L2 to look at Columns C:D. If it matches the number in column D, I want it to place the corresponding information from column C in K2.

I thought this would work, but so far I can't get it...

=IF(ISNA(VLOOKUP(L2,C:D,2,FALSE))=TRUE,0,VLOOKUP(L2,C:D,1,FALSE))

(I have that in K2)

Is there something I am missing or something I've screwed up?

Thanks,
Swish
 
One more question I forgot to ask...is it possible to do a vplookup with the lookup coming from a PivotTable?
 
Vlookup requires that the known quantity be located in the first column of the array that you are referencing. Your best bet would be to use Match and Index

=INDEX(C:D,MATCH(L2, D:D),1)
 
Where should it match the number in column D? Are you trying to find any number in either of the columns C & D? Which number should be transferred to K2. You cannot transfer a whole column into one cell.

Do you mean that if the info in L2 = D2, transfer the info from C2 into K2? You don't need a VLOOKUP, just a simple IF statement.

Lets assume C2 contains the value 1234, D2 contains 1 and L2 contains 1. In cell K2 put the formula
=IF(L2=D2,C2,""). Lo and behold, cell K2 will contain 1234. If you change the value of either D2 or L2 so that they are not equal, cell K2 will become blank. Does this do it?
 
Thanks for the help. Xhelp, the Index worked perfectly.

LeKirk, I wouldn't be able to do an IF statement in the case I was looking at. Trust me, I wish I could have. I had thought about that solution at first, but I had a problem with maybe cell L2=D43, and then L3=D199, etc, etc. I needed it look through all of the cells in D and find it's matching value and input C. Of course I didn't think that Vplookup only went one direction (Whoops), so the Index clause was what I was looking for.

Thanks again for the feedback guys. I appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top