This article describes the formula syntax and usage of the BITAND function (function: A prewritten formula that takes a value or values, performs an operation, and returns a value or values. Use functions to simplify and shorten formulas on a worksheet, especially those that perform lengthy or complex calculations.) in Microsoft Excel.
Returns a bitwise 'AND' of two numbers.
BITAND( number1, number2)
The BITAND function syntax has the following arguments.
- Number1 Required. Must be in decimal form and greater than or equal to 0.
- Number2 Required. Must be in decimal form and greater than or equal to 0.
- BITAND returns a decimal number.
- The result is a bitwise 'AND' of its parameters.
- The value of each bit position is counted only if both parameter's bits at that position are 1.
- The values returned from the bit positions progress from right to left as powers of 2. The rightmost bit returns 1 (2^0), the bit to its left returns 2 (2^1), and so on.
- If either argument is less than 0, BITAND returns the #NUM! error value.
- If either argument is a non-integer or is greater than (2^48)-1, BITAND returns the #NUM! error value.
- If either argument is a non-numeric value, BITAND returns the #VALUE! error value.
The workbook below shows examples of this function. Inspect them, change existing formulas, or enter your own formulas to learn how the function works.
To work more in-depth with the example data in Excel, download the embedded workbook to your computer, and then open it in Excel.
Top of Page