> ...Is there any operator or
> function in MS Excel to reverse
> the bit pattern of a binary number?
Hi. Excel vba has a limited capability of using Xor to reverse bit
patterns. You can usually find workarounds. Since your bin # is too
large for Excel, here's one of a few workarounds using Xor.
Sub Demo()
Dim bin, dec, Inv
bin = 111011110101#
'dec=3829
dec = bin2dec(Left(bin, 3)) * 512 + bin2dec(Right(bin, 9))
Inv = dec2bin(dec Xor (2 ^ Len(bin) - 1))
Debug.Print Format(Inv, "000000000000")
End Sub
Returns: 000100001010
HTH
Dana DeLouis
David Biddulph wrote:
> "Aashu" <[email protected]> wrote in
> message news:[email protected]...
>>
>>
>>
>>
>> My dear friends & respected ones,
>> warm regards to everybody.
>>
>> I am new to this forum. My query is :Is there any operator or
>> function in MS Excel to reverse the bit pattern of a binary no. as we
>> perform in Boolean mathematics.
>>
>> Eg. Suppose there is any binary no. in cell A5 as "111011110101", so by
>> using any operator, how inverted binary no. i.e. "000100001010" can be
>> obtained.
>>
>> Also are there other operators so as to perform AND, OR, EX-OR
>> operations of digital electronics?
>
> If the binary number had been only 10 digits, you could have used
> =DEC2BIN(-(BIN2DEC(A5)-1),10)
Bookmarks