FormulaCraft

BITAND

BITAND performs a bitwise AND operation on two non-negative decimal integers, returning a new integer where each bit is 1 only if the corresponding bits of both operands are 1. It is commonly used to check whether a specific flag or permission bit is set in a bitmask field.

Excel
=BITAND(12,10)
Google Sheets
=BITAND(12,10)

Verified example

Computed by a real spreadsheet engine on the sample data below.

Number1Number2BITAND Result
1210=BITAND(12,10)
75=BITAND(7,5)
25515=BITAND(255,15)
63=BITAND(6,3)

=BITAND(12,10)8

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

How it works

  1. 1Provide the first non-negative integer as argument 1 (e.g., 12 = binary 1100).
  2. 2Provide the second non-negative integer as argument 2 (e.g., 10 = binary 1010).
  3. 3The result is the decimal integer whose bits are 1 only where both inputs have a 1 bit (12 AND 10 = 8 = binary 1000).

Need a version for your data?

Try: “Check which permission bits are set in both user and role masks using bitwise AND

Related

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: