BITRSHIFT function
BITRSHIFT shifts the bits of a number to the right, which divides it by powers of two and drops any remainder. It returns a whole number, and results of 2^48 or more return #NUM!.
Example
Read it as a sentence: shift the bits of 16 right by 2 places, which gives 4.
A
B
C
D
1
4
2
3
Syntax
BITRSHIFT(number, shift_amount)
-
number(required) - A whole number of 0 or more.
-
shift_amount(required) - How many bit positions to shift; negative values shift the other way.
Returns: The shifted whole number.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=BITRSHIFT(4,2) | 1 | 4,2 |
=BITRSHIFT(4,0) | 4 | Shift 0 |
=BITRSHIFT(4,-2) | 16 | Negative shift |
=BITRSHIFT(1,53) | 0 | Shift 53 |
=BITRSHIFT(1,-53) | 0 | Shift -53 |
=BITRSHIFT(4,1.9) | 2 | Decimal shift 1.9 |
=BITRSHIFT(1,54) | #NUM! | Shift 54 |
=BITRSHIFT(2^47,-1) | #NUM! | Result over 2^48 |
Watch out for
- Results of 2^48 or more return #NUM!.
Where it works
- Excel
- BITRSHIFT arrived in Excel 2013. Older versions do not have it.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Engineering functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .