BITLSHIFT
Shifts a non-negative integer left or right by a given bit count.
Positive shift_amount shifts left; negative shift_amount shifts right.
The Formualizer engine in this repository at 0.15.0 plus unreleased changes computes the example results. Known differences from Excel are listed on this page.
Syntax
=BITLSHIFT(number, shift_amount)
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
number | number | Required | — |
shift_amount | number | Required | — |
Remarks
numbermust be a whole number in[0, 2^48).
Error cases
- Shift values are numerically coerced; large positive shifts can return
#NUM!. - Left-shift results must remain below
2^48, or the function returns#NUM!.
Examples
Move the bits of 12 by two positions.
Formula =BITLSHIFT(12,2)
Expected result 48
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
A negative shift reverses the direction of the operation.
Formula =BITLSHIFT(12,-2)
Expected result 3
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
A zero-position shift leaves the bits in place.
Formula =BITLSHIFT(12,0)
Expected result 12
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Negative operands are outside the supported integer domain.
Formula =BITLSHIFT(-1,2)
Expected result #NUM!
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Shift left by two bits
Formula =BITLSHIFT(6,2)
Expected result 24
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Use negative shift to move right
Formula =BITLSHIFT(32,-3)
Expected result 4
Try this formula
This editor runs the published Formualizer 0.14.0 package, so the last digits can differ and functions newer than that release return #NAME?.
Related functions
FAQ
What does a negative shift_amount do in BITLSHIFT?
Negative shifts are interpreted as right shifts, while positive shifts move bits left.