ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   OR function produces incorrect result (https://www.excelbanter.com/new-users-excel/251063-function-produces-incorrect-result.html)

mz

OR function produces incorrect result
 
I am testing the "OR" function and it seems to produce a false result even
when only one of two logical arguments is false (that is, it is acting like
the AND function that requires all arguments to be true).

Here is the formula I wrote:

Cell D2 is 50
Cell D3 is 3

=IF(OR(D2=6,D3=3),"OK","No good")

The result is "No good" even though the second argument is true.


--
MZ

Joe User[_2_]

OR function produces incorrect result
 
"MZ" wrote:
I am testing the "OR" function and it seems to produce a false
result even when only one of two logical arguments is false

[....]
Cell D2 is 50
Cell D3 is 3
=IF(OR(D2=6,D3=3),"OK","No good")


Obviously, you have made a mistake. But what that mistake is is anyone's
guess. My guesses:

1. One or both of the contents of D2 and D3 are text, not numeric. What
does TYPE(D2) and TYPE(D3) return?

or

2. You have not copy-and-pasted the formula verbatim from the Formula Bar
into your message, and you have an error in your formula that is not
apparent in your message because you subconsciously corrected the error when
you retyped the formula.

or

3. You misrepresented the facts: D3 is not 3.


----- original message -----

"MZ" wrote in message
...
I am testing the "OR" function and it seems to produce a false result even
when only one of two logical arguments is false (that is, it is acting
like
the AND function that requires all arguments to be true).

Here is the formula I wrote:

Cell D2 is 50
Cell D3 is 3

=IF(OR(D2=6,D3=3),"OK","No good")

The result is "No good" even though the second argument is true.


--
MZ



Eduardo

OR function produces incorrect result
 
Hi,
The formula is correct and works fine, check if the number in D3 is not
formated as a text

"MZ" wrote:

I am testing the "OR" function and it seems to produce a false result even
when only one of two logical arguments is false (that is, it is acting like
the AND function that requires all arguments to be true).

Here is the formula I wrote:

Cell D2 is 50
Cell D3 is 3

=IF(OR(D2=6,D3=3),"OK","No good")

The result is "No good" even though the second argument is true.


--
MZ


JLatham

OR function produces incorrect result
 
As Eduardo said, more than likely D3 is formatted as text. A quick test:
change your formula to
=IF(OR(D2=6,D3="3"),"OK","No Good")
if you get OK, then D3 is definitely formatted as text or the number has a
single apostrophe in front of it, forcing it to be treated as text.

"Eduardo" wrote:

Hi,
The formula is correct and works fine, check if the number in D3 is not
formated as a text

"MZ" wrote:

I am testing the "OR" function and it seems to produce a false result even
when only one of two logical arguments is false (that is, it is acting like
the AND function that requires all arguments to be true).

Here is the formula I wrote:

Cell D2 is 50
Cell D3 is 3

=IF(OR(D2=6,D3=3),"OK","No good")

The result is "No good" even though the second argument is true.


--
MZ


Joe User[_2_]

OR function produces incorrect result
 
"Joe User" <joeu2004 wrote:
Obviously, you have made a mistake.
But what that mistake is is anyone's guess.


I forgot the most obvious one: D3 only __appears__ to be 3 due to
formatting, but the actual numeric value is something else.

D3 might contain a date and/or time that you formatted to display only the
month number, day number, year of the century, hours, minutes or seconds.

Or D3 might contain a number with a decimal fraction that you format with
zero decimal places.

Or D3 might contain a number larger than 1000 that you formatted to display
only the thousands.

Finally (although I might have overlooked others)....


3. You misrepresented the facts: D3 is not 3.


Perhaps D3 contains 3% (0.03) that you are describing as 3.


----- original message -----

"Joe User" <joeu2004 wrote in message
...
"MZ" wrote:
I am testing the "OR" function and it seems to produce a false
result even when only one of two logical arguments is false

[....]
Cell D2 is 50
Cell D3 is 3
=IF(OR(D2=6,D3=3),"OK","No good")


Obviously, you have made a mistake. But what that mistake is is anyone's
guess. My guesses:

1. One or both of the contents of D2 and D3 are text, not numeric. What
does TYPE(D2) and TYPE(D3) return?

or

2. You have not copy-and-pasted the formula verbatim from the Formula Bar
into your message, and you have an error in your formula that is not
apparent in your message because you subconsciously corrected the error
when you retyped the formula.

or

3. You misrepresented the facts: D3 is not 3.


----- original message -----

"MZ" wrote in message
...
I am testing the "OR" function and it seems to produce a false result even
when only one of two logical arguments is false (that is, it is acting
like
the AND function that requires all arguments to be true).

Here is the formula I wrote:

Cell D2 is 50
Cell D3 is 3

=IF(OR(D2=6,D3=3),"OK","No good")

The result is "No good" even though the second argument is true.


--
MZ





All times are GMT +1. The time now is 08:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com