View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
JohnLVand JohnLVand is offline
external usenet poster
 
Posts: 10
Default Vlookup that only returns a value that satifies a condition.

Update here.
The IF ISERROR VLOOKUP doesn't work as I thought.
It picks up the first occurence of the Site# regardless of status.
I will just do without, or should I say "do" with the #N/A .

Thanks

"JohnLVand" wrote:

Thanks Toppers for the quick response...
And Kudos...This is exactly what I was looking for.
I tried the vlookups, and tinkered with the Index function, but I just
couldn't figure out the arrays and references.

One other thing though....
I get a #N/A in columns "B" and "C" for rows that do not have a site # keyed
in.
So I put an IF ISERROR VLOOKUP function in to get rid of the #N/A
Seems to work just fine.(using the ctrl/shift/enter)

=IF(ISERROR(VLOOKUP(A2,Jobs!$A$2:$D$8,1,0)),"--",(INDEX(Jobs!$B$2:$B$8,MATCH(1,(Jobs!$A$2:$A$8=A2 )*(Jobs!$D$2:$D$8="Current"),0))))

Thanks again.
"Toppers" wrote:
In column B:

=INDEX(Jobs!$B$2:$B$8,MATCH(1,(Jobs!$A$2:$A$8=A2)* (Jobs!$D$2:$D$8="Current"),0))

in column C:

=INDEX(Jobs!$C$2:$C$8,MATCH(1,(Jobs!$A$2:$A$8=A2)* (Jobs!$D$2:$D$8="Current"),0))

Enter both with Ctrl+Shift+Enter
"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