BITRSHIFT Function

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.

Syntax: 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 Example 1
 Formula:
A B
1 =BITRSHIFT( 20, 2 )  (20 has binary form 10100)
2
 Result:
A B
1 5  (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:

  • The binary form of 20 is 10100.
  • 10100 shifted right by two places is 101.
  • This number is returned in decimal form, as the number 5.

 

BitRShift Function Example 2
 Formula:
A B
1 =BITRSHIFT( 52, 4 )  (52 has binary form 110100)
2
 Result:
A B
1 3  (decimal form of 11)
2

In the above example:

  • The binary form of 52 is 110100.
  • 110100 shifted right by 4 places is 11.
  • This number is returned in decimal form, as the number 3.

 

BitRShift Function Errors

#NUM!

Occurs if either:

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

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

code

clearPost Comment