BITOR
TheBITOR
function returns a bitwise OR of two numbers.
- How to use
BITOR
formula? - Examples of using
BITOR
formula BITOR
formula not working?- Similar formulas to
BITOR
Usage
Use the 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.
Examples
Here are a few example use cases that explain how to use theBITOR
formula in Google Sheets.
Combine binary values
Use BITOR
to combine two binary values into a single value that has all the bits that are set in either value.
Set bit flags
Use BITOR
to set one or more bit flags in a binary value by bitwise ORing the value with the flag(s).
Create a bitmask
Use BITOR
to create a bitmask that can be used to test for multiple conditions at once by bitwise ORing the values of the conditions.
Common Mistakes
BITOR
not working? Here are some common mistakes people make when using the BITOR
Google 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.
Related Formulas
The following functions are similar to BITOR
or are often used with it in a formula:
-
BITAND
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.
-
BITXOR
The
BITXOR
function 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. -
DEC2BIN
The
DEC2BIN
formula 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.
Learn More
You can learn more about the BITOR
Google Sheets function on Google Support.