if and vlookup formula combination

Joined
Sep 28, 2011
Messages
3
Reaction score
0
I am trying to combine an if statement with a vlookup and I can't seem to make it work correctly. (performing just the vlookup works fine!)
I only want the vlookup to occur if the "If" statement is correct, else I want it to be 0.

In cell K4 I want the following formula: If cell E4 = 5, then perform the following vlookup =vlookup(F4,'Input Data'!D:K,8, False), else return a zero.

Thanks to whoever can help me!
Sally
 
sblojax,

=if(E4=5,vlookup(F4,'Input Data'!D:K,8, False),"0") should work. The syntax for an if formula is: Condition, value if true, value if false.

I do not have your data to test. In my test using a value for f4 that was not in the range returned #N/A

Stoneboysteve
 
Thanks for the help. That does work for the cells that have a hard coded value... but, the specific cells that are in question, are a formula based on INDEX - sorry i failed to mention that in the first email. Can you possibly help me with that??

I have attached a sample of the file for you to see what I am trying to do.
Thanks in advance!
 

Attachments

After many hours of tedious work - I have figured it out!!!

In case anyone needs something similar, here is the formula that ended up working for me!!!

For cell H4 I used: =IF(INDEX('Input Data'!$B:$AI,$C4,11)=4,(VLOOKUP($E4,'Input Data'!$D:$K,8, FALSE)),0)

For cell I4 I used: =IF(INDEX('Input Data'!$B:$AI,$C4,11)="w",(VLOOKUP($E4,'Input Data'!$D:$K,8, FALSE)),0)

and so on.....

P.S. I also had to perform a "text to columns" for column L on the Input Data tab so it would pick up the "W".....

Thanks!!
 
Thanks for reporting back with the solution, it's always a help for other users who have the same problem :).
 
Back
Top