Engineering function

BITLSHIFT function

Shifts the bits of a number to the left by a given amount, which multiplies it by a power of 2. A negative shift moves bits right.

Available in Excel 2013 and later, Microsoft 365, Excel for the web, Excel for Mac 2016 and later

Excel 2013 and laterWorks in Google Sheets

Syntax

BITLSHIFT(number, shift_amount)
ArgumentWhat it means
numberRequiredA whole number from 0 to 2^48 − 1.
shift_amountRequiredHow many positions to move the bits to the left (adds zeros on the right). A negative value shifts right instead. Must be between -53 and 53.

Returns: A decimal number: number × 2^shift_amount, with any bits shifted past the right edge dropped.

How BITLSHIFT works

BITLSHIFT moves every bit of a number to the left and fills the gap on the right with zeros. Shifting left by one position doubles the number, by two quadruples it, and so on — BITLSHIFT(n, k) is the same as n * 2^k for positive shifts. Programmers use it to build masks (BITLSHIFT(1, 5) is the bit-5 mask, 32) and to pack small values into one larger number, for example placing a red value in the high byte of a colour.

A negative shift_amount shifts to the right instead, exactly like BITRSHIFT; bits that fall off the right-hand end are lost. The input must be a whole number from 0 to 2^48 − 1 and the result must also stay below 2^48, otherwise you get #NUM!.

Examples

1Shift left by 2

C2fx=BITLSHIFT(A2, B2)
ABC
1NumberShift
24216

Result: 16

4 is 100 in binary. Moving it two places left gives 10000 = 16, the same as 4 × 2².

2Pack two bytes into one number

C2fx=BITLSHIFT(A2, 8) + B2
ABC
1High byteLow byte
232321000

Result: 1000

Shifting 3 left by 8 bits gives 768; adding the low byte 232 rebuilds 1000. BITRSHIFT and BITAND split it apart again.

3Negative shift moves right

C2fx=BITLSHIFT(A2, B2)
ABC
1NumberShift
216-24

Result: 4

A shift of -2 moves the bits two places right: 10000 becomes 100, which is 4.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 15 KB

Common errors and how to fix them

ErrorWhy it happensFix
#NUM!The number is negative, not whole, at least 2^48, the result reaches 2^48, or |shift_amount| is more than 53.Keep inputs and results below 281,474,976,710,656; use multiplication by 2^k for larger values (limited by Excel's 15-digit precision).
#VALUE!An argument is non-numeric text.Convert with VALUE.

Tips

  • BITLSHIFT(1, n) is a quick way to create the mask for bit n.
  • Decimals in shift_amount are truncated, so 2.9 shifts by 2.

Google Sheets

BITLSHIFT also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

BITLSHIFT in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
DanishBITLSKIFT
DutchBIT.VERSCHUIF.LINKS
FinnishBITTI.SIIRTO.V
FrenchBITDECALG
GermanBITLVERSCHIEB
HungarianBIT.BAL.ELTOL
ItalianBIT.SPOSTA.SX
Norwegian (Bokmål)BITVFORSKYV
PolishBIT.PRZESUNIĘCIE.W.LEWO
Portuguese (Brazil)DESLOCESQBIT
Portuguese (Portugal)BITDESL.ESQ
RussianБИТ.СДВИГЛ
SpanishBIT.DESPLIZQDA
SwedishBITVSKIFT
TurkishBİTSOLAKAYDIR