BITOR function

Returns the bitwise OR of two numbers, combining all set bit positions from both values into a single numerical result.

=BITOR(number1, number2)

Generate a BITOR formula

Describe what you need. The generator will reach for BITOR where BITOR 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 BITOR reads its arguments
number1requirednumber2requiredBITOR
ArgumentRequiredDescription
number1RequiredA non-negative integer representing the first value in the bitwise operation; decimals are truncated to integers.
number2RequiredA non-negative integer representing the second value in the bitwise operation; decimals are truncated to integers.

Returns

An integer where each bit position represents the OR combination of the corresponding bits in both input numbers.

Availability

Excel: All · Google Sheets: Supported

Worked examples

1. Combine access permission codes for employees

EmployeeDepartmentBase AccessAdditional Access
SarahSales24
=BITOR(2,4)

Result: 6

Sarah's base access level is 2 (binary 0010) and she requires additional access 4 (binary 0100). BITOR merges them: 0010 OR 0100 = 0110 (decimal 6), encoding both permissions in a single code.

2. Merge employee status and department codes

EmployeeDepartmentStatus CodeDepartment Code
MichaelEngineering18
=BITOR(1,8)

Result: 9

Michael's active status is encoded as 1 (binary 0001) and his Engineering department as 8 (binary 1000). BITOR produces 0001 OR 1000 = 1001 (decimal 9), combining both attributes into a single classification code.

3. Create composite employee classification from salary band and tenure

EmployeeSalary BandTenure CodeHire Date
Rebecca1622018-05-30
=BITOR(16,2)

Result: 18

Rebecca's salary band 16 (binary 10000, senior level) is combined with tenure code 2 (binary 00010, representing 5+ years). BITOR merges them: 10000 OR 00010 = 10010 (decimal 18), creating a composite code.

Common errors

Which BITOR error are you seeing?
BITOR returned an error#VALUE!
Convert text to numeric codes first using MATCH or a lookup table: =BITOR(MATCH('Sales',DepartmentList,0), MATCH('Active',StatusList,0))
#NUM!
Ensure both numbers are non-negative and within valid range. Use ABS() if needed: =BITOR(ABS(number1), number2)
#REF!
Verify all referenced cells still exist in your worksheet and update cell references if columns were moved or removed.
ErrorWhy it happensHow to fix it
#VALUE!BITOR receives text values instead of numbers, such as passing 'Active' or 'Engineering' directly rather than their numeric codes.Convert text to numeric codes first using MATCH or a lookup table: =BITOR(MATCH('Sales',DepartmentList,0), MATCH('Active',StatusList,0))
#NUM!One or both arguments are negative numbers or exceed the maximum value (~2^48), as BITOR only accepts non-negative integers.Ensure both numbers are non-negative and within valid range. Use ABS() if needed: =BITOR(ABS(number1), number2)
#REF!The formula references cells that no longer exist, such as when a salary or department column is deleted from the dataset.Verify all referenced cells still exist in your worksheet and update cell references if columns were moved or removed.

Tips and when to use something else

  • BITOR is ideal for combining permission flags or binary feature codes; for simple true/false logic, use OR() instead.
  • Each bit position represents a separate feature or permission: bit 0 = 1, bit 1 = 2, bit 2 = 4, bit 3 = 8, bit 4 = 16, and so on.
  • Use BITAND to check whether a specific permission is included in a combined code, and BITXOR to toggle individual flags on or off.
  • BITOR truncates decimal inputs to integers, so 2.9 and 2.1 are both treated as 2; use INT() or ROUND() for explicit control.

Frequently asked questions

What is the difference between BITOR and OR?
OR performs logical comparison and returns TRUE or FALSE; BITOR performs bitwise comparison on individual bit positions and returns an integer. Use OR for Boolean checks ('Is salary > 50000 OR status is Active') and BITOR for combining numeric flags and permission codes.
How do I use BITOR to manage employee permissions and access levels?
Assign each permission its own bit position: read=1, write=2, delete=4, admin=8, etc. Use BITOR to combine multiple permissions (BITOR(1,2) = 3 for read+write), then use BITAND to check if a specific permission is granted: BITAND(3,2)=2 confirms write access is included.
Why do I get #NUM! error when using BITOR with employee salary data?
BITOR only accepts non-negative integers; if you use negative numbers (such as negative adjustments), it returns #NUM!. Convert to absolute values with ABS() first, or ensure your salary data and codes are positive before passing to BITOR.
Can I convert the BITOR result to see the binary representation?
Yes, use DEC2BIN to convert the result to binary: =DEC2BIN(BITOR(2,4)) displays '110', helping you visualize which bit positions are set. This is useful for debugging permission codes or understanding which features are combined.

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