Engineering

BITLSHIFT Formula

Shifts the binary representation of a number to the left by a specified number of positions, filling vacated positions with zeros. Each left shift effectively multiplies the number by 2, making BITLSHIFT useful for power-of-two calculations, bit manipulation, and low-level data processing.

Syntax

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

Examples

Shift left by 2

Formula
=BITLSHIFT(4, 2)
16. Binary 100 shifted left 2 positions becomes 10000 (decimal 16). Equivalent to 4 * 2^2 = 16.

Multiply by 8 using shifts

Formula
=BITLSHIFT(5, 3)
40. Shifting left by 3 multiplies by 2^3 = 8. So 5 * 8 = 40.

Create a bit mask

Formula
=BITLSHIFT(1, 7)
128. Shifts a single 1 bit to position 7, creating the bit mask 10000000 (128). Useful for setting or testing individual bits.

Common Errors

#NUM!

The number is negative, the shift amount exceeds 53, or the result exceeds 2^48 - 1.

#VALUE!

An argument is non-numeric.

Tips

Left shift = multiply by power of 2

BITLSHIFT(n, k) is equivalent to n * 2^k. This is faster in computing but equivalent in a spreadsheet — use whichever is clearer.

Create bit masks

BITLSHIFT(1, N) creates a mask with only bit N set. Use this with BITAND to test specific bits, or BITOR to set them.

Overflow caution

If the shift pushes bits beyond the 48-bit limit, you'll get a #NUM! error. Check that your number * 2^shift stays within range.

Try BITLSHIFT in Viztab

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

Open Viztab

Related Formulas