The Excel BITRSHIFT Function

Bitwise Functions

The Excel Bitwise functions convert the supplied integer value(s) to binary form and then perform an operation on the individual bits.

The result is then converted back to an integer value before being returned.

Further information on Bitwise operations is provided on the Wikipedia Bitwise Operation Page

Related Function:
BITLSHIFT

Basic Description

The Excel BitRShift function returns a supplied integer, shifted right by a specified number of bits.

Note: the BitRShift function was only introduced in Excel 2013 and so is not available in earlier versions of Excel.

The syntax of the function is:

BITRSHIFT( number, shift_amount )

where the supplied arguments are:

number-The number that you want the operation to be performed upon (must be a positive integer).
shift_amount-An integer value, specifying the number of bits by which the supplied number is to be shifted.

BitRShift Function Examples

Example 1

 Formula:
 AB
1=BITRSHIFT( 20, 2 )(20 has binary form 10100)
2  
 Result:
 AB
15(decimal form of 101)
2  

Decimal-Binary Conversion

If you want to work through the stages of an 'RSHIFT' operation you can use the Excel DEC2BIN and BIN2DEC functions to convert between decimal and binary forms.

In the above example:



Example 2

 Formula:
 AB
1=BITRSHIFT( 52, 4 )(52 has binary form 110100)
2  
 Result:
 AB
13(decimal form of 11)
2  

In the above example:


Further information and examples of the Excel BitRShift function are provided on the Microsoft Office website.


BitRShift Function Errors

Common Errors
#NUM!-

Occurs if either:

  • The supplied number argument is a non-integer;
  • The supplied number argument is negative or is greater than (2^48)-1.
#VALUE!-Occurs if one or both of the supplied arguments is non-numeric.