+ Reply to Thread
Results 1 to 6 of 6

Are there Boolean operators in MS Excel?

  1. #1
    Registered User
    Join Date
    07-29-2006
    Posts
    3

    Lightbulb Are there Boolean operators in MS Excel?





    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?


    Best Regards,
    -------------
    Aashu

  2. #2
    David Biddulph
    Guest

    Re: Are there Boolean operators in MS Excel?

    "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)
    --
    David Biddulph



  3. #3
    Dana DeLouis
    Guest

    Re: Are there Boolean operators in MS Excel?

    > ...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)


  4. #4
    Registered User
    Join Date
    07-29-2006
    Posts
    3
    Thanks All of you very much for prompt response & solving my problem and also showing me different ways for solving the same problem.



    Best Regards,
    -------------
    Aashu.




    Quote Originally Posted by Dana DeLouis
    > ...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)

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675
    Try this formula solution

    =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A5,0,2),1,0),2,1)

  6. #6
    Registered User
    Join Date
    07-29-2006
    Posts
    3
    Quote Originally Posted by daddylonglegs
    Try this formula solution

    =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A5,0,2),1,0),2,1)

    Thank you very much "DADYLONGLEGS", you have suggested me one of the simplest option very useful in my application.


    Thanks & Regards,
    -----------------
    Aashu

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1