Thread: Binary NOT?
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mark Scott[_3_] Mark Scott[_3_] is offline
external usenet poster
 
Posts: 1
Default Binary NOT?

Hi

I have successfully created functions for bitwise operators BInary AND, OR
and XOR using the following format in VBA (2010 beta)

Function Bin<operator(a, b)
Bin<operator = a <operator b
End Function

for example the XOR script is:

Function BinXor(a, b)
BinXor = a Xor b
End Function

when I try the same for NOT, VBA comes back with:

Function BinNot(a)
BinNot = Not a
End Function

which is fine as you can only NOT 1 number

The answers are not what I am expecting however, ie the corret outputs are
0=1 and 1=0 whereas the functions output is: 1= -2 and 0 = -1

What do I need to do to make this work or is there a built in "binary flip"
function in Excel?

Regards

Mark