View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Vlookup that only returns a value that satifies a condition.

try in projects!B1
=if(vlookup(A1,Jobs!A:D,4,0)="Current",vlookup(A1, Jobs!A:D,3,0))
or if what is in column A on projects may not be in column A Jobs
=if(iserror(vlookup(A1,Jobs!A:D,4,0),"",if(vlookup (A1,Jobs!A:D,4,0),="Current",vlookup(A1,Jobs!A:D,3 ,0),""))

"JohnLVand" wrote:

Hello, hope someone can help here. I've been hacking away on this one for days.
I'm looking for some code that can do a Vlookup (or other function) that
will do the following. Rather than trying to describe the logic, I thought
it may be easier to show you what has to be done..

The following data has been placed into a worksheet called "Jobs"
Row # 1 are titles.

A B C D
1 Site# Job# Name Status
2 a123 2005-012 KL Complete
3 90652 2003-120 NN Current
4 4b00v1 2007-001 AB Complete
5 8008 2006-234 PN Pending
6 a123 2007-123 KL Current
7 h7799 2004-222 KL Current
8 90652 2007-901 NN Complete
...
500 v456 2007-867 PN Current

I have another worksheet called "Projects"
In this worksheet I need to see the following "Current" projects ...

A B C
Site# Job# Name
1 90652 2003-120 NN
2 a123 2007-123 KL
3 h7799 2004-222 KL
4 v456 2007-867 PN


I would like to have cells in column "B" and "C" filled with values from
Worksheet "Jobs" only if the row has a Status of "Current".
The only information that I need to key in is Column "A" (Site #).
Columns "B" and "C" only get filled in if the condition is satisfied.

Any ideas or help would be most appreciated !

JLV