BITAND Function

Excel 2007+

Summary

The Excel BITAND function performs a bitwise AND operation between two decimal numbers, returning a decimal result where each bit is set only if corresponding bits in both input numbers are 1. Perfect for low-level binary manipulation and flag checking in Excel.

Syntax

BITAND(number1, number2)

Parameters

Parameter Type Required Description
number1 Number Yes Required decimal number greater than or equal to 0 and less than or equal to 2^48-1
number2 Number Yes Required decimal number greater than or equal to 0 and less than or equal to 2^48-1

Using the BITAND Function

BITAND enables binary-level operations directly in Excel formulas. Convert decimal numbers to their binary representation, perform AND logic bit-by-bit, and return the resulting decimal. Ideal for checking shared bit flags, mask operations, and binary protocol parsing.

Common BITAND Examples

Basic BITAND: 1 and 5

=BITAND(1,5)

1 (binary: 0001) AND 5 (binary: 0101) = 1 (binary: 0001). Only rightmost bit matches.

Multiple Bits: 13 and 25

=BITAND(13,25)

13 (binary: 1101) AND 25 (binary: 11001) = 9 (binary: 1001). Bits 0 and 3 match.

Flag Checking

=BITAND(A1,4)>0

Checks if bit 2 (value 4) is set in A1. Returns TRUE if set.

Frequently Asked Questions

Decimal integers from 0 to 2^48-1 (281474976710655). Negative numbers, decimals, or larger values return #NUM!.

No, BITAND requires decimal numbers. Use BIN2DEC first if converting from binary text.

Compares binary representations bit-by-bit. Result bit = 1 only when both input bits = 1.

Common Errors and Solutions

#NUM!

Cause: Number < 0, non-integer, or > 2^48-1

Solution: Use positive integers within valid range: 0 to 281474976710655

#VALUE!

Cause: Non-numeric input

Solution: Ensure both arguments are numbers

Unexpected result

Cause: Misunderstanding binary positions

Solution: Convert to binary manually to verify bit positions

Notes

  • Rightmost bit = 2^0 (1), next = 2^1 (2), then 2^2 (4), etc.
  • Maximum value: 281474976710655 (2^48-1)
  • Pair with BITOR, BITXOR, BITLSHIFT for complete binary toolkit
  • Results always decimal, not binary string

Compatibility

Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365

Not available in: Excel 2003, Excel XP, Excel 2000, Excel 97

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+