Table of Contents
Performing a left bitwise shift on a range of cells in Google Sheets allows you to shift the binary representation of the values in that range to the left by a specified number of bits. This operation is useful for manipulating binary data or performing calculations using binary logic. To perform a left bitwise shift on a range of cells in Google Sheets, you can use the BITLSHIFT function, which takes the range of cells and the number of bits to shift as its arguments. This function will return the shifted values in the specified range, without affecting the original data. This feature is useful for automating tasks and performing complex calculations in Google Sheets.
BITLSHIFT function
The BITLSHIFT function shifts the bits of the input a certain number of places to the left. Bits on the right are filled with zeroes (0s).
Parts of a BITLSHIFT function
BITLSHIFT(value,shift_amount)
| Part | Description | Notes |
value | The number to be shifted. | Must be a non-negative number. |
shift_amount | The number of places to shift. | Must be a value between -53 and 53, inclusive. Supplying a negative value will effectively be a BITRSHIFT. |
Sample formulas
BITLSHIFT(9, 2)
BITLSHIFT(A2, 4)
Notes
- Values don’t necessarily have to be numbers.
- Values may be coerced. For example, a string value of “3” can be coerced to be simply 3 and a boolean value of TRUE can be coerced to 1.
Examples
In this example, we use BITLSHIFT with values inlined into the function. The value 2 (represented as 10 in base 2) has its bits shifted left by the shift_amount of 2, resulting in 8 (represented as 1000 in base 2).
| A | B | |
| 1 | Formula | Result |
| 2 | =BITLSHIFT(2,2) | 8 |
Similar to the last example, a value of 2 being shifted by 2 results in a BITLSHIFT of 8. However, in this example, we use cell references to grab our values.
| A | B | C | |
| 1 | Formula | Result | Reference cells |
| 2 | =BITLSHIFT(C2,C3) | 8 | 2 |
Related functions
BITRSHIFT: The BITRSHIFT function shifts the bits of the input a certain number of places to the right. Bits on the left are filled with zeroes (0s).
Cite this article
stats writer (2024). How can I perform a left bitwise shift on a range of cells in Google Sheets?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-perform-a-left-bitwise-shift-on-a-range-of-cells-in-google-sheets/
stats writer. "How can I perform a left bitwise shift on a range of cells in Google Sheets?." PSYCHOLOGICAL SCALES, 28 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-perform-a-left-bitwise-shift-on-a-range-of-cells-in-google-sheets/.
stats writer. "How can I perform a left bitwise shift on a range of cells in Google Sheets?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-perform-a-left-bitwise-shift-on-a-range-of-cells-in-google-sheets/.
stats writer (2024) 'How can I perform a left bitwise shift on a range of cells in Google Sheets?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-perform-a-left-bitwise-shift-on-a-range-of-cells-in-google-sheets/.
[1] stats writer, "How can I perform a left bitwise shift on a range of cells in Google Sheets?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How can I perform a left bitwise shift on a range of cells in Google Sheets?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
