BITLSHIFT in Google Sheets: Shift Bits, Coerce Inputs and Pack Fields
Use Google Sheets BITLSHIFT with explicit direction, documented coercion and three-bit field examples, while keeping overflow boundaries visible.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: BITLSHIFT(value,shift_amount) shifts bits left for a positive count and fills the vacated right positions with zeros. Negative counts act as right shifts. Google documents counts from −53 through 53 and a nonnegative input value.
Availability and version history
- Introduced: first introduction date is not established by the reviewed official history; no desktop release number is inferred.
- Availability: documented in the rolling Google Sheets service; these examples use the web worksheet workflow.
- Checked: October 14, 2026; official BITLSHIFT reference. Documentation and independent models, with no native Sheets execution or wider client certification.
Syntax and Google-specific scope
=BITLSHIFT(value,shift_amount)
Both arguments are required. The dedicated page explicitly gives the nonnegative-value rule and the inclusive −53 to 53 shift-count interval. It also says text “3” may be coerced to 3 and TRUE to 1.
The reference does not separately settle fractional-input handling, a maximum source value, output-overflow behavior or every native error code. This guide uses small integer values and counts; it does not borrow another product’s additional limits.
For a positive count k, the small-integer bit model multiplies the value by 2^k. A negative count uses BITRSHIFT behavior and can discard low-order bits. These direction rules do not imply that every forward-and-back pair is reversible.
Example 1: append zeros to a binary representation
Enter 6 in A2 and counts 0, 1, 2, 3 and 4 in B2:B6. In C2 enter and fill through C6:
=BITLSHIFT($A$2,B2)
| Count | Expected decimal | Binary representation |
|---|---|---|
| 0 | 6 | 110 |
| 1 | 12 | 1100 |
| 2 | 24 | 11000 |
| 3 | 48 | 110000 |
| 4 | 96 | 1100000 |
In D2 enter =$A$2*2^B2 and fill down. The independent products are the same five values. A left shift adds binary positions, not decimal digits: shifting 6 by two gives 24, not 600.
Google’s own simple control shifts 2 by two positions and gets 8. The table above uses a different input so the general positional pattern can be checked independently.
Example 2: follow a negative shift
Enter 23 in F2. Its binary representation is 10111. The following controls demonstrate information loss:
| Formula | Expected decimal |
|---|---|
=BITLSHIFT(F2,-1) |
11 |
=BITLSHIFT(F2,-2) |
5 |
=BITLSHIFT(F2,-3) |
2 |
=BITLSHIFT(F2,-4) |
1 |
=BITLSHIFT(F2,-5) |
0 |
For −2, removing two trailing digits leaves 101, or 5. Ordinary division gives 23/4=5.75 instead. Shifting 5 left two positions returns 20, so the discarded remainder 3 has not been recovered.
Keep a separate low-bit remainder when reconstruction matters. A shift that intentionally discards bits should not be described as a lossless conversion.
Advanced example: pack two three-bit fields
Define a small record with two fields, each restricted to integers 0–7. Enter this table in H1:I5:
| H, high field | I, low field |
|---|---|
| 6 | 5 |
| 0 | 7 |
| 7 | 0 |
| 7 | 7 |
In J2 enter and fill through J5:
=BITOR(BITLSHIFT(H2,3),I2)
The packed values are 53, 7, 56 and 63. For the first row, the high field contributes 6×8=48 and the low field contributes 5. The six-bit label is 110101.
Use =BITRSHIFT(J2,3) to recover the high field and =BITAND(J2,7) to recover the low field. Expected pairs are 6/5, 0/7, 7/0 and 7/7. BITOR combines the fields and BITAND selects the low positions.
The width restriction is part of the data design. A low input of 13 overlaps the high field: high=6, low=13 combines to 61, which unpacks as 7 and 5. The formula cannot infer that the original record violated the three-bit schema.
Documented coercion and remaining boundaries
Using Google’s stated conversions, =BITLSHIFT("3",2) has independently expected result 12, and =BITLSHIFT(TRUE,3) has expected result 8. These examples do not establish coercion for arbitrary text, blanks or errors.
The right-shift reference separately states a count interval of −52 through 53. Preserve that function-specific wording rather than assuming both pages have identical lower endpoints; the small reverse-direction controls here avoid the discrepancy.
DEC2BIN can display the small packed values, for example =DEC2BIN(53,6) gives 110101. Its signed numeric interval remains separate from the shift operation. Exact native overflow, decimal-count treatment and error precedence are untested.
References and verification
Examples use fictional data, English function names and comma separators. Expected outputs are independent mathematical calculations or explicitly documented rules, not native Sheets captures. Check the spreadsheet locale when reproducing punctuation-sensitive formulas.