BITORfunction returns a bitwise OR of two numbers.
- How to use
- Examples of using
BITORformula not working?
- Similar formulas to
BITOR formula with the syntax shown below, it has 2 required parameters:
- value1 (required):
The first number or range to perform bitwise OR on.
- value2 (required):
The second number or range to perform bitwise OR on.
ExamplesHere are a few example use cases that explain how to use the
BITORformula in Google Sheets.
Combine binary values
BITOR to combine two binary values into a single value that has all the bits that are set in either value.
Set bit flags
BITOR to set one or more bit flags in a binary value by bitwise ORing the value with the flag(s).
Create a bitmask
BITOR to create a bitmask that can be used to test for multiple conditions at once by bitwise ORing the values of the conditions.
BITORnot working? Here are some common mistakes people make when using the
BITORGoogle Sheets Formula:
Using non-numeric inputs
Both inputs to
BITOR must be numeric values. If you try to use non-numeric inputs, you will get a #VALUE! error.
Using cell ranges with different dimensions
If you try to use cell ranges with different dimensions as inputs to
BITOR, you will get a #VALUE! error.
Not using enough arguments
You must provide two arguments to
BITOR in order for it to work correctly. If you provide only one argument or more than two arguments, you will get a #VALUE! error.
The following functions are similar to
BITOR or are often used with it in a formula:
The BITAND function returns a bitwise AND of two numbers. This function is commonly used in engineering applications where binary digits are manipulated to perform logical operations. The function takes two inputs, value1 and value2, and returns a decimal number that represents the bitwise AND of the two inputs.
BITXORfunction returns the bitwise XOR of two numbers. The function takes two numeric arguments and returns the result of the bitwise XOR operation performed on them.
DEC2BINformula is used to convert a decimal number to a binary number. This is commonly used in engineering and computer science to represent numbers in their binary form. The formula takes in a decimal number and an optional number of significant digits to include in the binary representation.
You can learn more about the
BITOR Google Sheets function on Google Support.