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)| Argument | What it means | |
|---|---|---|
number | Required | A whole number from 0 to 2^48 − 1. |
shift_amount | Required | How 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
| A | B | C | |
|---|---|---|---|
| 1 | Number | Shift | |
| 2 | 4 | 2 | 16 |
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
| A | B | C | |
|---|---|---|---|
| 1 | High byte | Low byte | |
| 2 | 3 | 232 | 1000 |
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
| A | B | C | |
|---|---|---|---|
| 1 | Number | Shift | |
| 2 | 16 | -2 | 4 |
Result: 4
A shift of -2 moves the bits two places right: 10000 becomes 100, which is 4.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#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_amountare 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.
| Language | Function name |
|---|---|
| Danish | BITLSKIFT |
| Dutch | BIT.VERSCHUIF.LINKS |
| Finnish | BITTI.SIIRTO.V |
| French | BITDECALG |
| German | BITLVERSCHIEB |
| Hungarian | BIT.BAL.ELTOL |
| Italian | BIT.SPOSTA.SX |
| Norwegian (Bokmål) | BITVFORSKYV |
| Polish | BIT.PRZESUNIĘCIE.W.LEWO |
| Portuguese (Brazil) | DESLOCESQBIT |
| Portuguese (Portugal) | BITDESL.ESQ |
| Russian | БИТ.СДВИГЛ |
| Spanish | BIT.DESPLIZQDA |
| Swedish | BITVSKIFT |
| Turkish | BİTSOLAKAYDIR |