A to Z of Excel Functions: the BITLSHIFT Function
20 February 2017
Welcome back to our regular A to Z of Excel Functions blog. Today we look at the BITLSHIFT function.
The BITLSHIFT function
It’s time for another of the most commonly used functions on the planet. If the planet is Uranus. This function returns a number shifted left by the specified number of bits. For those of us who have social lives, this means that you first convert the number to binary and then add on a specified number of zeros before converting the new binary number back to a decimal number.
The BITLSHIFT function employs the following syntax to operate:
The BITLSHIFT function has the following arguments:
- number: this is required, and must be an integer greater than or equal to 0
- shift_amount: this is also required. The shift_amount must be an integer.
It should be further noted that:
- shifting a number left is equivalent to adding zeros (0) to the right of the binary representation of the number. For example, a two-bit shift to the left on the decimal value 4 converts its binary value (100) to 10000, or 16 in decimal
- if either argument is outside their constraints, BITLSHIFT returns the #NUM! error value
- if number is greater than (2^48)-1, BITLSHIFT returns the #NUM! error value
- if the absolute value of shift_amount is greater than 53, BITLSHIFT returns the #NUM! error value
- if either argument is a non-numeric value, BITLSHIFT returns the #VALUE! error value
- a negative number used as the shift_amount argument shifts the number of bits to the right
- a negative number used as the shift_amount argument returns the same result as a positive shift_amount argument for the BITRSHIFT function.
Please see my example below:
We’ll continue our A to Z of Excel Functions soon. Keep checking back – there’s a new blog post every other business day.