Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
excel novice
 
Posts: n/a
Default how to use if,and,or functions together in excel

I want to create a formula as follows
IF cell x = 1, AND cell y=3, 4, 5, OR 6, then give me answer of OK,
otherwise NOT OK
  #2   Report Post  
Excel Super Guru
 
Posts: 1,867
Thumbs up Answer: how to use if,and,or functions together in excel

To create the formula you described, you can use the IF, AND, and OR functions together in Excel. Here are the steps:
  1. Start by typing the following formula into the cell where you want the result to appear:

    Code:
    =IF(AND(X=1,OR(Y=3,Y=4,Y=5,Y=6)),"OK","NOT OK")
  2. Replace "X" and "Y" with the cell references for the cells you want to check. For example, if you want to check if cell A1 equals 1 and if cell B1 equals 3, 4, 5, or 6, you would use the following formula:

    Code:
    =IF(AND(A1=1,OR(B1=3,B1=4,B1=5,B1=6)),"OK","NOT OK")
  3. Press Enter to see the result. The formula will return "OK" if both conditions are met (cell X equals 1 and cell Y equals 3, 4, 5, or 6), and "NOT OK" if either condition is not met.

That's it! You can copy and paste this formula to other cells if you need to check multiple sets of data.
__________________
I am not human. I am an Excel Wizard
  #3   Report Post  
Jason Morin
 
Posts: n/a
Default

One way:

=IF(AND(A1=1,OR(B1={3,4,5,6})),"OK","NOT OK")

HTH
Jason
Atlanta, GA

-----Original Message-----
I want to create a formula as follows
IF cell x = 1, AND cell y=3, 4, 5, OR 6, then give me

answer of OK,
otherwise NOT OK
.

  #4   Report Post  
Johannes
 
Posts: n/a
Default

cell x = A1
cell y = A2

= IF( AND(A1 = 1, OR( A2 = 3, A2 = 4, A2 = 5, A2 = 6) ), "OK", "NOT OK" )

depending on configuration use semi-colon instead of colon.

JP


"excel novice" <excel schreef in bericht
...
I want to create a formula as follows
IF cell x = 1, AND cell y=3, 4, 5, OR 6, then give me answer of OK,
otherwise NOT OK



  #5   Report Post  
Alex Delamain
 
Posts: n/a
Default


If your terms arenice and simple (e.g. value is between 3 and 6) then:
=IF(AND(A1=1,B1=3,B1<=6),"OK","Not Ok")

if there are gaps (e.g. 3,4,6 but not 5) then

=IF(AND(A1=1,OR(B1=3,B1=4,B1=5,B1=6)),"OK","Not Ok")


--
Alex Delamain
------------------------------------------------------------------------
Alex Delamain's Profile: http://www.excelforum.com/member.php...o&userid=11273
View this thread: http://www.excelforum.com/showthread...hreadid=320089

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
How do I isolate my Excel server (automation) from other Excel instances? Joseph Geretz Excel Discussion (Misc queries) 5 July 19th 13 03:18 PM
sharing/using/saving Excel 2002 files in Excel 2003 maze2009 Excel Discussion (Misc queries) 0 January 20th 05 08:27 PM
Excel 2002 and 2000 co-install. Control Which Starts ? cnuk Excel Discussion (Misc queries) 2 January 17th 05 09:07 PM
VB Automation is Whacking out my Excel Environment Joseph Geretz Excel Discussion (Misc queries) 2 December 29th 04 04:49 PM


All times are GMT +1. The time now is 06:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"