Engineering

BITRSHIFT Formula

Shifts the binary representation of a number to the right by a specified number of positions, discarding bits that fall off the right end. Each right shift effectively divides by 2 (with integer truncation), making BITRSHIFT useful for extracting bit fields, integer division by powers of two, and binary data parsing.

Syntax

BITRSHIFT(number, shift_amount)
ParameterDescription
number Parameter of the BITRSHIFT function.
shift_amount Parameter of the BITRSHIFT function.
Try BITRSHIFT in Viztab — free, no signup

Examples

Shift right by 2

Formula
=BITRSHIFT(16, 2)
4. Binary 10000 shifted right 2 positions becomes 100 (decimal 4). Equivalent to 16 / 2^2 = 4.

Integer division by 8

Formula
=BITRSHIFT(100, 3)
12. Shifting right by 3 divides by 2^3 = 8 and truncates. 100/8 = 12.5, truncated to 12.

Extract upper nibble from a byte

Formula
=BITRSHIFT(0xAB, 4)
10. Shifts 10101011 right by 4 positions to get 00001010 (decimal 10, hex A). Extracts the upper 4 bits of a byte.

Common Errors

#NUM!

The number is negative, or the shift amount is negative or exceeds 53.

#VALUE!

An argument is non-numeric.

Tips

Right shift = integer divide by power of 2

BITRSHIFT(n, k) is equivalent to INT(n / 2^k). The fractional part is discarded, not rounded.

Extract bit fields

Combine BITRSHIFT and BITAND to extract specific bit ranges: BITAND(BITRSHIFT(value, startBit), 2^numBits-1) isolates any bit field.

Bits shifted off are lost

Unlike left shift which fills with zeros, right shift permanently discards the rightmost bits. BITRSHIFT(BITLSHIFT(5, 2), 2) returns 4, not 5, if any bits were lost.

Try BITRSHIFT in Viztab

Import your data and use BITRSHIFT with 370+ other formulas. No signup required.

Open Viztab

Related Formulas