Help with Excel using IF and AND and OR and NOT functions

New Contributor

Hi, I'm trying to write a formula that incorporates the IF function and uses the OR, AND and NOT features.  

I want the formula to read:


IF cell G5="DS" or "DT" AND cell AF5 does not equal "FT10" or "FC10" or "TXTX" or "RSTK", then return the negative value in cell S5 otherwise, return 0.


Can anyone help with this?


thank you


11 Replies


That's like


if translate your text into formula

@Sergei Baklan 


Thank you so much for your help, it works perfectly!

@Sergei Baklan 


I'm so sorry, I spoke too soon, the formula isn't working.  It seems to be ignoring the second part of the equation with the <>"FT10","FC10", etc...


I've attached a sample with the formula in column Z.  All highlighted cells should be 0, yet they're returning -S5 value.  


I may not have explained what I want to see very well.  The highlighted cells are either DS or DT however, they have FT10, FC10, TXTX or RSTK in column AF, so I want them to be 0.  


The second OR should be replaced with AND in your formula, try this...






Or simply this...





Just the boolean logic.



@Detlef Lewin 

It needs only a small tweak...




Yes, thank you for the updated formula, that did the trick!


You're welcome! Glad to help.


If you use a table and group the Boolean conditions applied to a single variable within array constants, the resulting formula is almost readable

= IF( AND(
      OR( [@[Order Type]]={"DS","DT"} ),
      AND( [@Class]<>{"FT10","FC10","TXTX","RSTK"} ) ),
  -[@[Ext Price]],
  0 )

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
9 Replies