A to Z of Excel Functions: The BITRSHIFT Function
13 March 2017
Welcome back to our regular A to Z of Excel Functions blog. Today we look at the BITRSHIFT function.
The BITRSHIFT function
It’s time to find thee antidote to the recent BITLSHIFT function and you shouldn’t feel bitter (BITR?). This function first converts the number to binary and then removes a specified number of digits from the right of the binary number, i.e. this function returns a number shifted right by the specified number of bits.
The BITRSHIFT function employs the following syntax to operate:
BITRSHIFT(number, shift_amount)
The BITRSHIFT function has the following arguments:
- number: this is required and must be an integer greater than or equal to 0
- shift_amount: also required. This must be an integer.
It should be further noted that:
- shifting a number right is equivalent to removing digits from the rightmost side of the binary representation of the number. For example, a two-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.
Please see my example below:
We’ll continue our A to Z of Excel Functions soon. Keep checking back – there’s a new blog post every other business day.