Description
The Microsoft Excel OR function returns TRUE if any of the conditions are TRUE. Otherwise, it returns FALSE. Please note that the VBA version of the OR function has different syntax.
Syntax
The syntax for the OR function in Microsoft Excel is:
OR( condition1, [condition2, ... condition_n] )
Parameters or Arguments
- condition1
- A condition to test that can either be TRUE or FALSE.
- condition2, ... condition_n
- Optional. Conditions to test that can either be TRUE or FALSE. There can be up to 30 conditions.
Applies To
- Excel 2016, Excel 2013, Excel 2011 for Mac, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000
Type of Function
- Worksheet function (WS)
Example (as Worksheet Function)
Let's look at some Excel OR function examples and explore how to use the OR function as a worksheet function in Microsoft Excel:
Based on the Excel spreadsheet above, the following OR examples would return:
=OR(A1<10, A1=40)
Result: FALSE
=OR(A1=30, A2="Microsoft")
Result: TRUE
=OR(A1>=5, A1=20, A2="techonthenet.com")
Result: TRUE
Frequently Asked Questions
Question: In Microsoft Excel, I'm trying to use the If function to return 0 if cell A1 is either < 150,000 or > 250,000. Otherwise, it should return A1.
Answer: You can use the OR function to perform an OR condition in the If function as follows:
=IF(OR(A1<150000,A1>250000),0,A1)
In this example, the formula will return 0 if cell A1 was either less than 150,000 or greater than 250,000. Otherwise, it will return the value in cell A1.
Question: I have been looking at your Excel IF, AND and OR sections and found this very helpful, however I cannot find the right way to write a formula to express if C2 is either 1,2,3,4,5,6,7,8,9 and F2 is F and F3 is either D,F,B,L,R,C then give a value of 1 if not then 0. I have tried many formulas but just can't get it right, can you help please?
=IF(AND(C2>=1,C2<=9, F2="F",OR(F3="D",F3="F",F3="B",F3="L",F3="R",F3="C")),1,0)
Question:I have a nesting OR function problem:
My nonworking formula is:
=IF(C9=1,K9/J7,IF(C9=2,K9/J7,IF(C9=3,K9/L7,IF(C9=4,0,K9/N7))))
In Cell C9, I can have an input of 1, 2, 3, 4 or 0. The problem is on how to write the "or" condition when a "4 or 0" exists in Column C. If the "4 or 0" conditions exists in Column C I want Column K divided by Column N and the answer to be placed in Column M and associated row
Answer:You should be able to use the OR function within your IF function to test for C9=4 OR C9=0 as follows:
=IF(C9=1,K9/J7,IF(C9=2,K9/J7,IF(C9=3,K9/L7,IF(OR(C9=4,C9=0),K9/N7))))
This formula will return K9/N7 if cell C9 is either 4 or 0.
No comments:
Post a Comment