
Shift bits to the left by a chosen number of positions. Useful for scaling by powers of two, building masks, and moving values into higher bit positions.
BITLSHIFT moves the bits of a number to the left by a chosen number of positions. In practical terms, shifting left increases the value by powers of two as long as the result stays within Excel's supported range.
This is useful when you want to place a value into a higher bit position, build a mask, or scale a number in a bitwise way instead of plain arithmetic. It is one of the simplest tools for working with bit fields and packed values.
Moves bits into higher positions.
Returns the decimal value of the shifted bit pattern.
=BITLSHIFT(number, shift_amount)
number is the starting value. shift_amount is how many positions to move the bits.
A positive shift moves the bits to the left. A negative shift moves them the other way and behaves like BITRSHIFT. The answer is returned in decimal, even though the operation is happening on the binary form of the number.
number must be a whole number that is 0 or larger. shift_amount also has to be a whole number. Small shift values are the most practical because very large shifts can push the result outside the supported range and return #NUM!.
BITLSHIFT is about moving bits, not just multiplying numbers in the usual way:
| Function | What it does | Typical use | Result |
|---|---|---|---|
BITLSHIFT |
Moves bits left | Scale by powers of two or build masks | Number |
BITRSHIFT |
Moves bits right | Reduce or extract higher bits | Number |
* |
Multiplies numbers normally | Regular arithmetic | Number |
DEC2BIN |
Shows a value in binary text | Inspect the result visually | Binary text |
The most direct way to think about BITLSHIFT is that every left shift multiplies by 2. A shift of 1 doubles the value, a shift of 2 multiplies by 4, and so on. That makes it useful when you want a fast, bit-based way to scale a value.
It is also a good way to move a value into a higher field. For example, shifting 255 left by 8 puts that pattern into a higher byte position. That is handy when you are building masks or packed values from smaller pieces.
Microsoft also notes that BITLSHIFT works with non-negative integers up to 2^48 - 1, and if the absolute shift amount is greater than 53 Excel returns #NUM!. A negative shift amount acts like shifting right. Source: Microsoft Support, BITLSHIFT function.
One left shift doubles the value.
=BITLSHIFT(5, 1) // Returns 10
Shift decimal 5 left by 1 bit (x2). Formula: =BITLSHIFT(5, 1).
This pushes the bit pattern into a higher position.
=BITLSHIFT(255, 8) // Returns 65280
Shift bit-value 255 to the high-byte pos (8 bits). Formula: =BITLSHIFT(255, 8).
Shifting 1 is a simple way to get the value of a target bit.
=BITLSHIFT(1, 4) // Returns 16
Shift 1 by 4 bits to create a mask for bit-5 (16). Formula: =BITLSHIFT(1, 4).
A shift of 2 multiplies the value by 4.
=BITLSHIFT(7, 2) // Returns 28
Shift decimal 7 left by 2 bits (x4). Formula: =BITLSHIFT(7, 2).
#NUM!.Tell your friends about this post