XOR operator in Excel

L

lurchot

dear all,

In excel, it seem that XOR operator is not supported by default, are there
any other ways to work around?

Thanks.
lurchot
 
C

Chip Pearson

You can use the following formula to XOR cells A1 and A2.

=OR(AND(A1,NOT(A2)),AND(A2,NOT(A1)))

An expanded version handles the case when either A1 or A2 is empty:

=IF(OR(A1="",A2=""),NA(), OR(AND(A1,NOT(A2)),AND(A2,NOT(A1))))


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
C

Chip Pearson

This can be shortened to

=(A1<>0)+(A2<>0)=1


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
C

Chip Pearson

What version of Excel does not support Xor ?

I would assume that he was speaking of a worksheet function, not the VBA
operator.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
J

Jim Cone

Thanks Chip. I guess I got up too early.
--
Jim Cone


"Chip Pearson"
wrote in message
What version of Excel does not support Xor ?
I would assume that he was speaking of a worksheet function, not the VBA
operator.
--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


"Jim Cone"
wrote in message
 

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

Similar Threads


Top