ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How 2 use right shift "<<" and left shift "" operator in excel? (https://www.excelbanter.com/excel-programming/348935-how-2-use-right-shift-left-shift-operator-excel.html)

v-2ajpau

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

Leith Ross[_427_]

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

Hello v-2ajpau,

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

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=49603


Chip Pearson

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" wrote in message
...
How 2 use right shift "<<" and left shift "" operator in
excel?





All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com