AND and OR operator for multiple conditions

dellzy

Board Regular
Joined
Apr 24, 2013
Messages
146
Dear Excel Experts,

Please help me to understand. I have the below formula. I coded with understanding that:-

1. If in E2 meet the first condition, which is the value is "terminated", then automatically return result "Yes".
2. If E2 value is not "terminated", then moves on to the next part, which is if E2 value is "suspended" and at the same time A2 value matches one of the values in the range, it will still return "Yes", else "".

Correct me if I am wrong, if above statements are correct, why is my formula below still return error even the E2 value is "terminated"?
frown.gif



Code:
[/COLOR][COLOR=#333333]IF(OR(E3="terminated",AND(E3="suspended",MATCH(A3,$K$2:$K$28,0))),"Yes","")[/COLOR]


Appreciate your help.


Thank you so much.
DZ
 
Last edited:

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
almost there, try this...
=IF(E2="terminated", "Yes", IF(AND(E2="suspended",ISNUMBER(MATCH(A3,$K$2:$K$28,0))),"Yes",""))
 
Upvote 0
You don't need to repeat the result, ISNUMBER is enough

=IF(OR(E3="terminated",AND(E3="suspended",ISNUMBER(MATCH(A3,$K$2:$K$28,0)))),"Yes","")
 
Upvote 0
Hi FDibbins,

My original formula works when I put "ISNUMBER" from your solution. If you don't mind, may I ask what is the significance of ISNUMBER in this formula ya? Because earlier on I tried breaking down the condition to single IF(MATCH(A3,$K$2:$K$28,0), it gave me result even without "ISNUMBER".

Thanks a lot for your help.
 
Upvote 0
MATCH will either return a number (if found) or an error (if not found), so I test to see if it returns a number
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,580
Members
449,039
Latest member
Arbind kumar

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