View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Creating Boolean Functions

Hi:

XNOR(A1,B1) can be written as:

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

NAND(A1,B1) can be written as:

=NOT(AND(A1,B1))

These can quite easily be written as UDFs.

Function XNOR(A as Boolean, B as Boolean) As Boolean
XNOR = (A And B) Or (Not A And Not B)
End Function

Function NAND(A as Boolean, B as Boolean) As Boolean)
NAND = Not (A And B)
End Function

Regards,

Vasant.


"Professor James E. Hicks" wrote in
message ...
My Problem:

I want to create functions in Excel that can be used in
the exact same way as built-in functions are used.

For example:
to use the AND built-in function all I need to do is to
type the following into a cell:
=AND(TRUE,FALSE) ..... or
=AND(A1,B1), where cell A1 & B1 contains Boolean values.

The following functions do not exist as built-in
functions in Exce: XNOR & NAND. I would like to write
these functions and access them in the exact same manner
as the AND function:
=XNOR(TRUE,FALSE) or XNOR(A1,B1).

Please help