Question : Binary calculation by using worksheet functions

Hi,

Are there worksheet functions to execute binary calculations like AND, OR, XOR, Bitshift, ...
I checked the reference list but I couldn't find what I need.

A VBA solution is not really what I'm looking for. If Excel doesn't support these functions then I can write these functions myself but I hope there's an alternative.


Examples:
11101101 AND 00000010 = 00000000
11000001 OR  00000010 = 11000011


Thanks in advance,
FL

Answer : Binary calculation by using worksheet functions

Why don't you want to use vba? It is really trivial.

function myand (a as long, b as long)
myand = a and b   ' < other functions eqv imp not or xor are just as easy, myNand = not (a and b)
end function



Also, the Analysis ToolPak addin has functions like dec2hex and dec2bin that help display the results.

rberke

P.S. you can get fancy with:

Function myand(a As Long, b As Long, Optional c As Long, Optional d As Long)
myand = a And b
If IsMissing(c) Then Exit Function
myand = myand And c
If IsMissing(d) Then Exit Function
myand = myand And d
End Function
Random Solutions  
 
programming4us programming4us