 # How to use the BITRSHIFT Function in Excel

BITRSHIFT function in excel perform the Bitwise Right Shift operation on a decimal number and returns the decimal number after the operation performed.

Bitwise Right shift operation is performed on a binary number. Let’s consider a  decimal number 4 and bit Right shift to be 2. As we know 4 is represented as 100 in binary. So 2 zeros will be reduced from the right of the binary number by shifting Right.

 Number Binary number shift_amount Binary number after shift Number after shift 4 100 2 1 1

The BITRSHIFT function returns a Bitwise Right Shift of a decimal number upto shift_amount.
Syntax:

number1 : a positive integer number of base 10 (decimal number) to be shifted
shift_amount : an integer representing the amount of shift to occur on the number. This argument can be positive , zero or negative.

Here is the excel representation of the function As you can the function returns 1 after the bitwise Right shift of 2 on 4.

You can use the DEC2BIN & BIN2DEC function in excel to understand the conversion operation.

Now let’s get more understanding of the function via using them in some examples. Here we have some values as number & shift_amount in Columns. We need to get the bitwise Right shift operation on the given numbers using the BITRSHIFT function in excel

Use the formula :

=BITRSHIFT (A2, B2)

A2 : number provided to the function as cell reference
B2 : number provided to the function as cell reference The bitwise Right shift operation on 1 ( 01 ) by reducing one zero to the right of the number will be 0 ( 0 ).

Now copy the formula to other cells using the Ctrl + D shortcut key. As you can see here the BITRSHIFT function returns the result of the input values.
Notes:

1. Numbers can be given as argument to the function directly or using the cell reference in excel.
2. The numbers must be a valid decimal number between 0 & 281474976710655.
3. If a negative number is provided as Shift_amount argument to the function, the value shifts left.
4. The function returns the #NUM! Error
1. If either of the decimal number is less than 0 or greater than 248-1 which is 281474976710655.
2. If the resulting number exceeds the range of 0 to 248-1.
5. The function returns the #VALUE! Error,
1. If the input number is text or non-numeric.
2. If the shift_amount argument is text or non numeric.
3. If the shift amount is less than - 53 or greater than + 53.

Hope you understood how to use BITRSHIFT function and referring cell in Excel. Explore more articles on Excel mathematical conversion functions here. Please feel free to state your query or feedback for the above article.

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.