function explanation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

There is an Excel spreadsheet with this function, can someone walk me through
it in terms of how to interpret the first And and OR.

I understand that if A2 does not equal B2 "and" B2 = nothing enter nothing
AND IF A2 = nothing "and" B2 is not equal to nothing enter nothing but
explain the first AND OR. Also is this function able to be built through the
formula palette or wizard?

=IF(OR(AND(A2<>"",B2=""),AND(A2="",B2<>"")),"F","")
 
The logic is

IF
A2 not equal nothing AND B2 equal nothing
OR
A2 equal nothing and B2 not equal nothing
THEN
return F
ELSE
return nothing

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Leesa said:
=IF(OR(AND(A2<>"",B2=""),AND(A2="",B2<>"")),"F","")

Adding some white space to help parse it:

=IF(

OR(
AND(A2<>"",B2=""),
AND(A2="",B2<>"") ),

"F",
"")

The OR says that if either of those ANDs produces a true, the result if "F".
Otherwise, the result is "".

The AND statements say:

if B2 is empty but A2 isn't, or
if A2 is empty but B2 isn't

then "F". Otherwise "".

In other words, if either A2 or B2 is empty, but not both at the same time,
then "F".

This looks like something you'd have to produce by hand. It can be
difficult to write a function like this on-the-fly in the formula bar in
Excel. The color-coded parentheses help a bit, but not enough. Sometimes
you can build the expression piece by piece in other cells and paste the
parts into the final formula.
 
Leesa said:
There is an Excel spreadsheet with this function, can someone walk me through
it in terms of how to interpret the first And and OR.

I understand that if A2 does not equal B2 "and" B2 = nothing enter nothing
AND IF A2 = nothing "and" B2 is not equal to nothing enter nothing but
explain the first AND OR. Also is this function able to be built through the
formula palette or wizard?

=IF(OR(AND(A2<>"",B2=""),AND(A2="",B2<>"")),"F","")

What you have is a kind of XOR or eXclusive OR function

/Fredrik
 
Seriously, if the OP doesn't know how to interpret the nested OR/AND
construct, do you think saying it is an XOR function would shed much light
on it? <g>
 
Tom Ogilvy said:
Seriously, if the OP doesn't know how to interpret the nested OR/AND
construct, do you think saying it is an XOR function would shed much light
on it? <g>

Yes, I do. XOR is something you can search for. I think there are many sites
that provide good explanations as to why or when you should use it. I also
used the term "exclusive or" which I think should help in understanding the
intention of the function. We'll know for sure if Leesa replies.

Best Regards,
Fredrik
 
Looks like another possible way to write this could be that if only one of
the two cells is blank, then enter 'F.
=IF(COUNTIF(A2:B2,"")=1,"F","")
... Also is this function able to be built through the
formula palette or wizard?

For some reason, only Vba has an Xor function. It's too bad it's not a
worksheet function.
 
Thanks Fredrik, Dana, Bob, and Shawn. I did take it further and search for
more info on the XOR function.
 

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

Back
Top