IF - AND - OR Combination

carlosbourn

New Member
Joined
Nov 9, 2007
Messages
17
Hi,

I am trying the following formula:

=IF(AND(J6="Yes",OR(B6<>"Nigeria",B6<>"Togo")),30%,0)

In order to do the following:

If J6 = "Yes" and B6 does not equal "Nigeria" or "Togo" then return 30%, otherwise 0.

But if I test it by having J6 as "Yes" and insert either "Nigeria" or "Togo" into B6, it still returns 30%...?

Many thanks in advance for any help.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Maybe you do not need the OR

=IF(AND(J6="Yes",B6<>"Nigeria",B6<>"Togo"),30%,0)

=IF(AND(J6="Yes",B6<>{"Nigeria","Togo"}),30%,0)
 
Upvote 0
Hello again, I'm a little stuck again!

I now need to reverse the formula to something like this because the number of possible variables in B6 has increased so rather than stating <> I thought it would be better to state =:

=IF(AND(J6="Yes",B6="Indian Ocean etc",B6="Togo"),30%,0)

However, if I have J6 as "Yes" and insert either "Indian Ocean etc", it returns 0 instead of 30%...? is this because this way around cell B6 has to equal both "Indian Ocean etc" and "Togo"?

Many thanks in advance for any help.
 
Upvote 0
Try

=IF(AND(OR(B6={"Indian Ocean","Togo"}),J6="Yes"),30%,0)

If B6 contains either Indian Ocean OR Togo AND J6 = "Yes"
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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