# AND/OR FUNCTION

Hi,
LOGIC
IF A1 = abcd  AND B1 = blue  then 99
OR
IF A1 = abcd AND B2 = yellow then 99
otherwise zero
Many thanks
Ian
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EngineerCommented:
=if(and(A1="abcd",or(b1="blue",b2="yellow")),99,0)
0
retiredAuthor Commented:
Thanks Saqib
If I wanted to return 99 if A1 =abcd and B1 <> blue  OR   B1 <> yellow
how would the formula look ?
* no B2 cell this time.
0
EngineerCommented:
Just change b2 to b1

=if(and(A1="abcd",or(b1="blue",b1="yellow")),99,0)
0
retiredAuthor Commented:
I was wanting it to return 99 only if b1 did not contain "blue" or "yellow" and zero if contained blue or yellow........ A1 should always be abcd
0
Excel & VBA ExpertCommented:
Hi Ian,

Maybe you need this...

``````=IF(AND(A1="abcd",B1<>"blue",B1<>"yellow"),99,0)
``````
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

retiredAuthor Commented:
I did change the question from = to <> so apologies for that.
Thanks to both of you.
Ian
1
retiredAuthor Commented:
I was trying to place the OR function and that is where I got into a mess.
0
Excel & VBA ExpertCommented:
You're welcome Ian. Glad it worked as desired in the end. :)
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.