In this post, you will learn about the BITLSHIFT function, the formula syntax, and the usage of the function in Microsoft Excel.
BITLSHIFT Function in Excel
The BITLSHIFT function in Excel shifts left by the specified amount of Shift in bits of a given number and return the decimal value of the number.
Syntax
BITLSHIFT(number, shift_amount)
Arguments:
- Number – The Number must be an integer and it should be greater than or equal to 0.
- Shift_amount – It should be an integer.
- Version – Available on Excel 2013 version.
Note:
If the number of bit shifts resulting in an integer overflow ( larger than 2^48 -1), the function returns the #NUM! error.
Example
Take a look at the table below,
Number | Shift_amount | Result |
13 | -1 | 6 |
13 | 0 | 13 |
13 | 1 | 26 |
Formula: BITLSHIFT (A1, B1)
Use this above formula while working in Excel worksheet. Enter the formula in the cell C1.
The number column is the number that you need to manipulate and the Shift_Left column is the number of digits that you need to left-shift the ‘Number’.
The result column is the actual result of the BITLSHIFT.
Now, let’s see what happens inside the process.
Number | Shift_amount | Result |
00001101 | -1 | 00000110 |
00001101 | 0 | 00001101 |
00001101 | 1 | 00011010 |
The number 13 has the binary value ‘00001101’, and when we do a negative left shift to this binary value, the resultant would be “00000110” i.e, the left shift runs for the amount of time you declare in the shift_amount Column. It Shifts bits left for the number by adding zeros (0) to the right of the number represented in binary, and the resultant number is returned in decimal value.