+ Reply to Thread
Results 1 to 3 of 3

How 2 use right shift "<<" and left shift ">>" operator in excel?

  1. #1
    v-2ajpau
    Guest

    How 2 use right shift "<<" and left shift ">>" operator in excel?

    How 2 use right shift "<<" and left shift ">>" operator in excel?

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello v-2ajpau,

    Excel doesn't have builtin left and right shift operators. You would need to construct a User Defined Funtion (UDF) in VBA . If you have a computer science background (I assume you do or you wouldn't post this question) you know what is involved in the binary math. I suspect if you search the web you find someone who has written the routines already.

    Sincerely,
    Leith Ross

  3. #3
    Chip Pearson
    Guest

    Re: How 2 use right shift "<<" and left shift ">>" operator in excel?

    VBA doesn't have any bit shift operators. You can replicate bit
    shifts by multiplying or dividing by the appropriate power of 2.

    Function ShiftLeft(Num As Long, Places As Integer) As Long
    ShiftLeft = Num * (2 ^ Places)
    End Function

    Function ShiftRight(Num As Long, Places As Integer) As Long
    ShiftRight = Num \ (2 ^ Places)
    End Function

    Note that there is no error checking in these procedures.

    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "v-2ajpau" <v-2ajpau@discussions.microsoft.com> wrote in message
    news:13AFB30F-AA60-412C-86BB-FAD66D190E8D@microsoft.com...
    > How 2 use right shift "<<" and left shift ">>" operator in
    > excel?




+ 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