I have an excel table where I want to use Vlookup to find an account number and return information in a certain column related to that account. However, I want to use an IF command within the Vlookup. For example, lookup accoutn number in column 1, IF the value in the 7th column is "S" then return the value in the sixth column, otherwise leave it blank. How can I combine If and Vlookup to do this? Many thanks for your help.

Ally B

The arguments in an =IF() statement are: =IF(Logical test , Value If TRUE , Value If FALSE)

So something like:

=IF(G1="S",VLOOKUP,NoVLookup)

Is that what your looking for?

MIKE

I re-read your post and I think what your looking for is something

more along the lines of:=IF( 1stVLOOKUP="S" , 2ndVlookupget# , DoNothing )

MIKE

Something like this should work, assuming the Account Number will always exist in Column 1. If there is a possibility that it won't, then you are going to have to modify the formula for the #N/A error that will occur. =IF(VLOOKUP(A1, $B$1:$H$7, 7, 0) = "S", VLOOKUP(A1, $B$1:$H$7, 6, 0), "")

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Ask Your Question

Weekly Poll

Do you agree with Google's decision to shut down Google+?

Discuss in The Lounge

Poll History