BITRSHIFT Function in Google Sheets

Shift a number's bits to the right by a specified amount using the BITRSHIFT function.

BITRSHIFT Function

The BITRSHIFT function in Google Sheets is used to shift the bits of a number to the right by a specified number of places.

Syntax

BITRSHIFT(value, shift_amount)
  • value: The number whose bits you want to shift. This is a required parameter.
  • shift_amount: The number of positions to shift the bits to the right. This is also a required parameter.

Examples

  1. Basic Shift

Shift the bits of 16 to the right by 2 places:

=BITRSHIFT(16, 2)

This will output 4.

  1. Shift with Larger Values

Shift the bits of 18 to the right by 1 place:

=BITRSHIFT(18, 1)

This will output 9.

Notes

  • A right shift operation effectively divides the number by 2 for each position shifted, rounding down to the nearest integer.
  • The function only accepts positive integers for the shift_amount.
  • BITLSHIFT: Shift a number’s bits to the left by a specified amount.
  • BITAND: Perform a bitwise AND operation on two numbers.