< Back

BITRSHIFT function

Thu Jul 25, 2019 11:03 am

BITRSHIFT function

This article describes the formula syntax and usage of the BITRSHIFT function in Microsoft Excel.



Description Returns a number shifted right by the specified number of bits.



Syntax BITRSHIFT(number, shift_amount) The BITRSHIFT function syntax has the following arguments.
  • Number Required. Must be an integer greater than or equal to 0.
  • Shift_amount Required. Must be an integer.
Remarks

Shifting a number right is equivalent to removing digits from the rightmost side of the binary representation of the number. For example, a 2-bit shift to the right on the decimal value 13 converts its binary value (1101) to 11, or 3 in decimal.
  • If either argument is outside its constraints, BITRSHIFT returns the #NUM! error value.
  • If Number is greater than (2^48)-1, BITRSHIFT returns the #NUM! error value.
  • If the absolute value of Shift_amount is greater than 53, BITRSHIFT returns the #NUM! error value.
  • If either argument is a non-numeric value, BITRSHIFT returns the #VALUE! error value.
  • A negative number used as the Shift_amount argument shifts the number of bits to the left.
  • A negative number used as the Shift_amount argument returns the same result as a positive Shift_amount argument for the BITLSHIFT function.
Example Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.


Formula


Description


Result
=BITRSHIFT(16,2) Shifts bits right for the number by stripping the 2 rightmost digits of the number represented in binary. The number returned is represented in decimal. 4
=BITRSHIFT(A4,3) Shifts bits right for the number by stripping the 3 rightmost digits of the number represented in binary. 3.51844E+13
=2^48-1 Maximum value allowed as argument for this function. 2.81475E+14




How is it Calculated ?



136 in binary is 10000

Moving it twice to the right we get : 00100

Decimal value of :00100 is 4



Image