BITLSHIFT Function in Google Sheets

Shift a number's bits to the left by a specified amount using the BITLSHIFT function.

BITLSHIFT Function

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

Syntax

BITLSHIFT(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 left. This is also a required parameter.

Examples

  1. Basic Shift

Shift the bits of 4 to the left by 2 places:

=BITLSHIFT(4, 2)

This will output 16.

  1. Shift with Negative Value

Shift the bits of 3 to the left by 1 place:

=BITLSHIFT(3, 1)

This will output 6.

Notes

  • A left shift operation effectively multiplies the number by 2 for each position shifted.
  • The function only accepts positive integers for the shift_amount.
  • BITRSHIFT: Shift a number’s bits to the right by a specified amount.
  • BITXOR: Perform a bitwise XOR operation on two numbers.