How to use BITAND function in Excel?

The `BITAND` function in Excel is used to perform a bitwise “AND” operation on two integer numbers. The function returns a decimal number that represents the bitwise AND of the binary representations of the two numbers.

Here’s how to use the `BITAND` function:

Syntax

BITAND(number1, number2)
  • number1: The first non-negative integer argument.
  • number2: The second non-negative integer argument.

Steps to Use BITAND Function

  • Open Excel: Start Excel and open a workbook or create a new one.
  • Select a Cell: Click on the cell where you want to display the result of the `BITAND` function.
  • Enter the Formula:
    • Type `=BITAND(`.
    • Enter the first number or reference the first cell that contains the integer you want to use.
    • Add a comma `,`.
    • Enter the second number or reference the second cell that contains the integer you want to use.
    • Close the parenthesis `)` and press `Enter`.

Example

Suppose you want to perform a bitwise AND operation on 5 and 3:

  • Enter the formula: `=BITAND(5, 3)`
  • Press `Enter`.

Explanation of the Example:

  • The binary representation of 5 is `101`.
  • The binary representation of 3 is `011`.
  • The bitwise AND operation compares each bit of the numbers:
    • `101`
    • `011`
    • Equals `001`

The result of this bitwise AND operation is `1` (since `001` is `1` in decimal).

Notes

  • Both arguments, `number1` and `number2`, must be integers. If either number is not an integer, Excel will truncate them to integers.
  • If either argument is negative, the `BITAND` function will return a `#NUM!` error.
  • Both numbers must be within the range of 0 to (2^48)-1, inclusive. If the numbers are outside of this range, the function will return a `#NUM!` error.

Using the `BITAND` function can be particularly useful in fields that involve low-level data processing, such as programming or digital circuit design, where bitwise operations are commonplace.

Unlock Your Potential

Excel

Basic - Advanced

Access

Access Basic - Advanced

Power BI

Power BI Basic - Advanced

Help us grow the project