If statement with vlookup

albert211994

New Member
Joined
Feb 7, 2017
Messages
10
Hi! I'am trying put a value in a selected cell using if and vlookup.

Here is the formula
Code:
=IF($N13="","",IF(VLOOKUP($N13,Directory!$F:$F,1,0)=$N13,"G",IF(VLOOKUP($N13,Directory!$G:$G,1,0)=$N13,"S",""))

It returns "G" if the value returned from vlookup from column F of directory is equal to N13 but if it is false it returns #n/a instead doing vlookup again in column G of directory.

Hope you can help.
Thank you.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi albert211994 and welcome aboard.

If I understand correctly try this formula. BTW the IFERROR function only works in Excel 2007 and newer. Let us know if you are using other version. If G:G doesn't contain $N13 you will need to wrap this in another IFERROR ... IFERROR(AllBelowFormula,"")

Code:
=IFERROR(IF($N13="","",IF(VLOOKUP($N13,Directory!$F:$F,1,0)=$N13,"G")),IF(VLOOKUP($N13,Directory!$G:$G,1,0)=$N13,"S",""))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,336
Messages
6,130,100
Members
449,557
Latest member
SarahGiles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top