OR function produces incorrect result

M

MZ

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.
 
J

Joe User

MZ said:
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 -----
 
E

Eduardo

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

JLatham

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.
 
J

Joe User

Joe User said:
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 said:
MZ said:
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 said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top