Using IF, AND, OR and VLOOKUP in one

bat18

Board Regular
Joined
Mar 29, 2010
Messages
89
Hi,

Here is my problem I am trying to write

'if the value in E1 is anywhere in column T AND either R1 OR S1 is in column U then TRUE, otherwise FALSE'

Now using vlookups to get the values works fine, also when i combine the IF statement with AND it works but when i try

=IF(AND(VLOOKUP(....., OR(VLOOKUP....

it just wont work. Any help on this would be greatly appreciated

Thanks
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
If its an array formula you're using I had this problem

Try using

IF(condition1,IF(condition2,TRUE,FALSE),FALSE)

rather than

IF(AND(condition1, condition2),TRUE,FALSE)
 
Upvote 0
I have worked out that the problem is within the OR(VLOOKUP... bit. One of the two criteria will work and one will always not i just need that atleast one of them hold but as soon as one of them fail the whole formula fails. If none of this makes sense i will send the actual formulas being used.

Thanks
 
Upvote 0
This works fine

=IF(AND(VLOOKUP($E2, $U$1:$U$30000, 1, FALSE), VLOOKUP($S1, $V$1:$V$30000, 1, FALSE )),TRUE, FALSE)

As soon as i try and get another condition in there it fails

=IF(AND(VLOOKUP($E2, $U$1:$U$30000, 1, FALSE), OR(VLOOKUP($R1, $V$1:$V$30000, 1, FALSE), VLOOKUP($S1, $V$1:$V$30000, 1, FALSE ))),TRUE, FALSE)

Special K would i need to use three if statements in this case??

Thanks again
 
Upvote 0
Try the below,
Replace "TRUE" and "FALSE" (at the end) with whatever you want

=IF(AND(ISERROR(VLOOKUP(E1,T:T,1,0))=FALSE,OR(ISERROR(VLOOKUP(R1,U:U,1,0))=FALSE,ISERROR(VLOOKUP(S1,U:U,1,0))=FALSE)),"TRUE","FALSE")
 
Upvote 0
Hi

If I could drop in my two pence worth - in this situation I avoid using VLOOKUP cos I get error conditions if the values aren't found.... I'd use COUNTIF ....e.g.

=if(and(countif(e1,T:T)>0,or(countif(r1,T:T)>0,countif(s1,T:T)>0)),T,F)

but then maybe I shouldn't be getting the errors with VLOOKUP

Kevin
 
Upvote 0
The problem with the OR and the vlookup is that you don't get a true/false result from the formula. You get an error or a number. You should be using isnumber(match() to get a true/false result, which will allow the OR to properly calculate.
 
Upvote 0
Yes absolutely right dcamos and that is definitely why xankx's formula worked perfectly for me. Cheers to all the above!!
 
Upvote 0
Just adding to this thread,

I am having trouble matching values that are obtained from other formulas. I really don't want to have to copy and paste values all the time and would like to know if anyone knows what i'm doing wrong? or if there is a formula to pick up values
 
Upvote 0
It depends on what the formula is bringing back. You might not exactly be matching what you are looking for, a little more info would be helpful.
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,369
Members
449,080
Latest member
Armadillos

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