BITAND function

BITAND returns the bitwise AND of two non-negative integers, useful for checking if both values share certain bits or permission flags.

=BITAND(number1, number2)

Generate a BITAND formula

Describe what you need. The generator will reach for BITAND where BITAND is the right tool, and tell you when it is not.

How to get a better answer
  • Name your columns by letter and by header: "column F (Net Value)" beats "the amount column".
  • State every condition, including the negatives — "not cancelled" changes the formula's shape.
  • Say where the data starts if it is not row 1, and whether it will grow.
  • Check the settings above match your spreadsheet: the wrong argument separator is a syntax error on your machine.

Arguments

How BITAND reads its arguments
number1requirednumber2requiredBITAND
ArgumentRequiredDescription
number1RequiredA non-negative integer (0 or greater); decimals are truncated to integers; must be numeric or causes #VALUE!.
number2RequiredA non-negative integer (0 or greater); decimals are truncated to integers; must be numeric or causes #VALUE!.

Returns

A non-negative integer representing the bitwise AND result in decimal form.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Verify if a task owner has both Read and Write permissions

TaskOwnerStart DateDue DateHoursAccess Level
Design DatabaseAlex2026-09-012026-09-07167
API DevelopmentJordan2026-09-022026-09-10246
Testing & QASam2026-09-052026-09-12123
=BITAND(F2, 3)

Result: 3

Alex's access level is 7 (binary 0111, representing Read=1 + Write=2 + Delete=4). BITAND(7, 3) tests for bits 1 and 2 together, returning 3 because both are present. If the result equals 3, both permissions are granted.

2. Check which tasks grant Delete permission to owners

TaskOwnerStart DateDue DateHoursAccess Level
Design DatabaseAlex2026-09-012026-09-07167
API DevelopmentJordan2026-09-022026-09-10246
Testing & QASam2026-09-052026-09-12123
=IF(BITAND(F2, 4)=4, "Yes", "No")

Result: Yes, Yes, No

Delete is bit value 4. BITAND(7, 4)=4 (Alex can delete), BITAND(6, 4)=4 (Jordan can delete), BITAND(3, 4)=0 (Sam cannot). The IF wrapper displays results as Yes/No for readability.

3. Find common permissions shared between two task owners

TaskOwnerStart DateDue DateHoursAccess Level
Design DatabaseAlex2026-09-012026-09-07167
API DevelopmentJordan2026-09-022026-09-10246
Testing & QASam2026-09-052026-09-12123
=BITAND(F2, F3)

Result: 6

Alex (7 = 0111 binary) and Jordan (6 = 0110 binary) have overlapping permission bits. BITAND(7, 6) = 6 (binary 0110), isolating the Write and Delete permissions both owners share.

Common errors

Which BITAND error are you seeing?
BITAND returned an error#VALUE!
Ensure both arguments contain actual numbers. Use VALUE() to convert text: =BITAND(VALUE(F2), 6), or verify your data source stores numbers, not text.
#NUM!
Use non-negative integers only. For decimals, truncate with INT() or TRUNC(): =BITAND(INT(F2), 6). Check for negative values in your source data.
#REF!
Update the formula with valid cell references. Use the Name Manager to verify named ranges, or re-enter the formula pointing to existing cells.
ErrorWhy it happensHow to fix it
#VALUE!One or both arguments contain text, are empty cells, or non-numeric content, such as =BITAND("7", 6) or =BITAND(F2, "admin").Ensure both arguments contain actual numbers. Use VALUE() to convert text: =BITAND(VALUE(F2), 6), or verify your data source stores numbers, not text.
#NUM!One or both arguments are negative (BITAND only accepts 0 and positive integers) or contain decimals, such as =BITAND(-7, 6) or =BITAND(7.5, 6).Use non-negative integers only. For decimals, truncate with INT() or TRUNC(): =BITAND(INT(F2), 6). Check for negative values in your source data.
#REF!The formula references a cell or range that no longer exists, such as =BITAND(F2, Z999) where column Z or row 999 was deleted.Update the formula with valid cell references. Use the Name Manager to verify named ranges, or re-enter the formula pointing to existing cells.

Tips and when to use something else

  • BITAND shines for permission systems and status flags encoded as bits. Wrap it in IF to create readable permission checks: =IF(BITAND(level, 4)=4, "Can Delete", "Cannot").
  • Master binary visualization: use DEC2BIN to see bit patterns clearly. =DEC2BIN(7) displays 111, making it obvious that bits 0, 1, and 2 are all set.
  • To check a single permission, compare the result to that bit's value: =IF(BITAND(access, 2)=2, "Write OK", …). For multiple permissions, sum their bit values into a mask: =BITAND(access, 1+2)=3.
  • BITAND checks for shared bits (AND logic). Use BITOR to combine flags, BITXOR to find differences, and AND() for traditional TRUE/FALSE logic—each has a different purpose.

Frequently asked questions

How do I check if a permission level has ANY of multiple permissions, not ALL?
Use BITAND with a condition that checks if the result is greater than 0. For example, to see if a user has Read (1) OR Write (2): =IF(BITAND(level, 3)>0, "Has at least one", "Has neither"). The mask 3 combines bits 1 and 2; any non-zero result means at least one permission exists.
Why does BITAND(4, 2) return 0?
Because 4 in binary is 100 and 2 in binary is 010—they share no common bits. BITAND only returns 1 where both numbers have a 1 in the same position. This is the correct and expected behavior; it means those two values have no overlapping flags.
What's the practical limit on the size of numbers BITAND can handle?
BITAND works with integers up to 2^48 - 1 (about 281 trillion) in Excel and Google Sheets. Beyond that, precision degrades. For systems requiring larger bit flags, consider restructuring as separate boolean columns instead.
What's the difference between BITAND and the AND function?
AND evaluates logical conditions and returns TRUE or FALSE, used in decision logic like =AND(hours>8, status="approved"). BITAND performs binary arithmetic on the bit representations of integers, used for flag checking like =BITAND(permissions, 4). Use AND for booleans; use BITAND for bit manipulation.

Need a different formula?

The full generator is not scoped to one function — describe any spreadsheet problem and it will pick.

Open the formula generator

Reviewed 2026-09-17