if And

nirvehex

Well-known Member
Joined
Jul 27, 2011
Messages
505
Office Version
  1. 365
Platform
  1. Windows
Hi,

This code should return the value in AQ10, but for some reason I'm getting a #VALUE error.

Code:
=IF(AND(VLOOKUP(A10,'WOs (DSP Only)'!A:B,2,FALSE)=VLOOKUP(A10,'WOs (DSP Only)'!A:C,3,FALSE)=VLOOKUP(A10,'WOs (DSP Only)'!A:D,4,FALSE)=VLOOKUP(A10,'WOs (DSP Only)'!A:E,5,FALSE)=VLOOKUP(A10,'WOs (DSP Only)'!A:F,6,FALSE),VLOOKUP(A10,'WOs (DSP Only)'!A:F,6,FALSE)>=5,VLOOKUP('WOs (DSP Only)'!A:F,6,FALSE)<=7.5),AQ10,"wrong")

All the VLOOKUPS 100% equal 7.2. But at some point it gives me a TRUE=FALSE in the AND statement. I'm trying to test if all the VLOOKUP give equal each other, which they do, but this statement doesn't work. What am I doing wrong?

Thanks!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
asre you sure its 100% same value - I have seen this type of issue where because of the overflow error in 14 digit numbers you get
7.1999999999999999999999
or
7.2000000000000000001
instead of 7.2
maybe worth just checking a few of the vlookup values and doing just a VLOOKUP(A10,'WOs (DSP Only)'!A:B,2,FALSE)=VLOOKUP(A10,'WOs (DSP Only)'!A:C,3,FALSE)
see if you get TRUE

OPS - missed the AND()
Thanks
Special-K99
 
Last edited:
Upvote 0
You cant say IF B=C=D=E=F which is effectively what you have with the VLOOKUPs
You have to say (IF(AND(B=C,B=D,B=E...etc

Try

=IF(AND(VLOOKUP(A10,'WOs (DSP Only)'!A:B,2,FALSE)=VLOOKUP(A10,'WOs (DSP Only)'!A:C,3,FALSE),VLOOKUP(A10,'WOs (DSP Only)'!A:B,2,FALSE)=VLOOKUP(A10,'WOs (DSP Only)'!A:D,4,FALSE),VLOOKUP(A10,'WOs (DSP Only)'!A:B,2,FALSE)=VLOOKUP(A10,'WOs (DSP Only)'!A:E,5,FALSE),VLOOKUP(A10,'WOs (DSP Only)'!A:B,2,FALSE)=VLOOKUP(A10,'WOs (DSP Only)'!A:F,6,FALSE),VLOOKUP(A10,'WOs (DSP Only)'!A:F,6,FALSE)>=5,VLOOKUP('WOs (DSP Only)'!A:F,6,FALSE)<=7.5),AQ10,"wrong")
 
Last edited:
Upvote 0
Depending opn your values you might be able to shorten that to

=IF(AND(VLOOKUP(A10,'WOs (DSP Only)'!A:B,2,FALSE)+VLOOKUP(A10,'WOs (DSP Only)'!A:C,3,FALSE)+VLOOKUP(A10,'WOs (DSP Only)'!A:D,4,FALSE)+VLOOKUP(A10,'WOs (DSP Only)'!A:E,2,FALSE)+VLOOKUP(A10,'WOs (DSP Only)'!A:F,2,FALSE)=VLOOKUP(A10,'WOs (DSP Only)'!A:B,2,FALSE)*6,VLOOKUP(A10,'WOs (DSP Only)'!A:F,6,FALSE)>=5,VLOOKUP('WOs (DSP Only)'!A:F,6,FALSE)<=7.5),AQ10,"wrong")
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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