Engineering

BITOR Formula

Returns the bitwise OR of two non-negative integers. Each bit in the result is 1 if the corresponding bit in either (or both) input numbers is 1. BITOR is used to combine flags, set specific bits, or merge binary masks in engineering and programming contexts.

Syntax

BITOR(number1, number2)
ParameterDescription
number1 Parameter of the BITOR function.
number2 Parameter of the BITOR function.
Try BITOR in Viztab — free, no signup

Examples

Basic OR operation

Formula
=BITOR(5, 3)
7. In binary: 101 OR 011 = 111, which is 7 in decimal. Every bit that's set in either number appears in the result.

Set a flag bit

Formula
=BITOR(8, 4)
12. In binary: 1000 OR 0100 = 1100. Combines bit 3 and bit 2 into a value with both flags set.

Combine permission flags

Formula
=BITOR(BITOR(1, 2), 4)
7. Combines read (1), write (2), and execute (4) permissions into 7 (all permissions). Nested BITORs combine multiple flags.

Common Errors

#NUM!

One or both numbers is negative, or exceeds 2^48 - 1.

#VALUE!

An argument is non-numeric.

Tips

Setting bits

BITOR(value, 2^N) sets bit N without affecting other bits. This is the standard way to turn on a specific flag.

Combine multiple flags

To set multiple flags at once, OR them together: BITOR(BITOR(flag1, flag2), flag3). Or use nested BITORs.

Complement of BITAND

BITAND tests which bits are common to both values; BITOR merges all bits from both values. They're complementary operations.

Try BITOR in Viztab

Import your data and use BITOR with 370+ other formulas. No signup required.

Open Viztab

Related Formulas