if and VLOOKUP formula help

DIMWIT

Board Regular
Joined
Jul 13, 2006
Messages
52
Hi

I have been wracking my tiny brain all day and cannot figure out what I am doing wrong.

Basically my formula needs to do the following:

lookup a value in a set column according to ID number and if this is blank to leave blank and do nothing else,
if not blank to lookup another column value and based on this value (0 or 1) perform another lookup

My formula is:

=IFERROR(IF(VLOOKUP($B7,Primary,J$2,FALSE)="","",IF($AH7=0,VLOOKUP($B7,Primary,J$3,FALSE),VLOOKUP($B7,Primary,J$126,FALSE))),"")

The formula brings out the correct data but the first condition, if its blank then leave as blank and do nothing else is being ignored.

Any clues?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I notice that your vlookup is too a specific cell not a range do you want to look at the entire column of J or just the specific cells J2, J3 and J126

Or is Primary a listed range of cells?

Try this replace ranges as needed.

=IF(VLOOKUP(L1,A:B,2,0)="","",VLOOKUP(VLOOKUP(L1,A:B,2,0),F:G,2,0))
 
Last edited:
Upvote 0
Hi , its looking at the Primary worksheet and is looking at a specific cell. This cell denotes the relevant column in the Primary Worksheet

so for example for ID 2236 look up the value in column 23.
 
Upvote 0
not sure if maybe putting the VLOOKUP in its own set of brackets might return the result to test if = "" (nothing)

untested


Code:
=IFERROR(IF([COLOR=#ff0000]([/COLOR]VLOOKUP($B7,Primary,J$2,FALSE)[COLOR=#ff0000])[/COLOR]="","",IF($AH7=0,VLOOKUP($B7,Primary,J$3,FALSE),VLOOKUP($B7,Primary,J$126,FALSE))),"")
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,772
Members
449,095
Latest member
m_smith_solihull

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