BITLSHIFT Function

Basic Description

The Excel BitLShift function returns a supplied integer, shifted left by a specified number of bits. Note: the BitLShift function was only introduced in Excel 2013 and so is not available in earlier versions of Excel.

Syntax: BITLSHIFT( number, shift_amount )

where the supplied arguments are:

number The number that you want the operation to be performed upon
(must be a positive integer).
shift_amount An integer value, specifying the number of bits by which the supplied number is to be shifted.

 

BitLShift Function Example 1
 Formula:
A B
1 =BITLSHIFT( 5, 2 )  (5 has binary form 101)
2
 Result:
A B
1 20  (decimal form of 10100)
2

Decimal-Binary Conversion

If you want to work through the stages of an ‘LSHIFT’ operation you can use the Excel DEC2BIN and BIN2DEC functions to convert between decimal and binary forms.

In the above example:

  • The binary form of 5 is 101.
  • 101 shifted left by two places is 10100.
  • This number is returned in decimal form, as the number 20.

 

BitLShift Function Example 2
 Formula:
A B
1 =BITLSHIFT( 3, 5 )  (3 has binary form 11)
2
 Result:
A B
1 96  (decimal form of 1100000)
2

In the above example:

  • The binary form of 3 is 11.
  • 11 shifted left by 5 places is 1100000.
  • This number is returned in decimal form, as the number 96.

 

BitLShift Function Errors

#NUM!

Occurs if either:

    – the supplied number argument is a non-integer.
or
    – the supplied number argument is negative or is greater than (2^48)-1.
or
    – the function result evaluates to a value greater than 2^48.
#VALUE! one or both of the supplied arguments is non-numeric.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

code

clearPost Comment