The `BITLSHIFT` function in Excel is used to perform a bitwise left shift on a given number. This essentially shifts the bits of a number to the left by a specified number of positions. Each left shift effectively multiplies the number by 2 for each shift position.
Here’s the syntax for the `BITLSHIFT` function:
BITLSHIFT(number, shift_amount)
- number: The decimal number you want to shift. It should be a non-negative integer.
- shift_amount: The number of positions you want to shift the number to the left. This can be a positive or negative integer.
Usage Example:
Let’s say you want to shift the number 5 (binary 101) two positions to the left.
=BITLSHIFT(5, 2)
- 5 in binary is `101`.
- Shifting it two positions to the left gives you `10100`.
- `10100` in binary is equivalent to 20 in decimal.
Therefore, the formula will return `20`.
Things to Consider:
- Shift Amount: If the shift amount is positive, the shift is to the left. If it’s negative, it’s a right shift equivalent (though for positive input, `BITLSHIFT` nominally deals with left shifts only, and right shifts are not directly supported via this function).
- Bit Overflow: Excel has a limit to the bit size of integers it can process (typically up to 48 bits for `BITLSHIFT`). If you shift a number left more than this limit, you may encounter unexpected results.
- Compatibility: This function is available in Excel 2013 and later versions, and it is part of the engineering functions group.
By understanding these fundamentals, you can effectively use the `BITLSHIFT` function to manipulate numbers using bitwise operations in Excel.