vlookup in if

A

Alec Green

can you uses vlookup within an if statement, I can both functions to work
separately but not together.

Thanks

Alec
 
P

Pete_UK

Yes,you can use VLOOKUP( ) within an IF statement. Tell us what you
want to do and we might be able to help further.

Pete
 
A

Alec Green

My VLookup is =VLOOKUP(G3,PRODUCTS!$A$3:$D$311,2,FALSE)

and i'm trying to do something like this
=IF(A1="yes",VLOOKUP(G3,PRODUCTS!$A$3:$D$311,2,FALSE)
+20%,VLOOKUP(G3,PRODUCTS!$A$3:$D$311,2,FALSE)

basically if A1 is yes, then vlookup the value in products plus 20%, if A1
is not yes then just return the vlookup value

Thanks!
 
D

Dave Peterson

You could use:

=if(a1="yes",1.2*vlookup(...),vlookup(...))

or maybe just:

=vlookup(...)*if(a1="yes",1.2,1)
 
P

Pete_UK

Yes, you can't just add 20% to the value returned by the vlookup as you
are trying to do, you have to multiply this value by 1.2 (i.e. 120%) as
Dave suggests.

Pete
 
P

Pete_UK

Ok, copying yours down from above:

=IF(A1="yes",VLOOKUP(G3,PRODUCTS!$A$3:$D$311,2,FALSE)*1.2,
VLOOKUP(G3,PRODUCTS!$A$3:$D$311,2,FALSE))

You had missed off a bracket at the end.

Hope this helps.

Pete
 
D

Dave Peterson

I think I would have used:

=VLOOKUP(G3,PRODUCTS!$A$3:$D$311,2,FALSE)*if(a1="yes",1.2,1)

I think it's easier to understand (and it does less stuff).
 
P

Pete_UK

Yeah, I thought about putting that version for the OP as well, but then
he already had the other one so it would be easier for him to edit that
(only 4 characters needed changing, plus his missing bracket).

Pete
 
Top