How can I use the BITOR function in Google Sheets to perform a logical OR operation on two or more values?

How can I use the BITOR function in Google Sheets to perform a logical OR operation on two or more values?

The BITOR function in Google Sheets allows users to perform a logical OR operation on two or more values. This function takes in binary values and returns a result based on the Boolean logic principle of “either/or.” It evaluates each bit of the given values and returns a 1 if any of the bits are 1, otherwise it returns a 0. This function can be useful in various scenarios, such as identifying if any of the given conditions are met, or combining multiple conditions into one. By using the BITOR function, users can efficiently perform logical OR operations in their Google Sheets, saving time and effort.

BITOR function

The BITOR function returns the bitwise Boolean OR of 2 numbers. The BITOR truth table is below:

ABBITOR(A, B)
000
011
101
111

Parts of a BITOR function

BITOR(value1, value2)

PartDescriptionNotes
value1The first number.
  • The given value must be a decimal representation of the number.
value2The second number.
  • The given value must be a decimal representation of the number.

Sample formulas

BITOR(9, 5)

BITOR(A1, 10)

BITOR(A1, B1)

Notes

It may make sense to use BITOR in conjunction with BIN2DEC as BITOR(BIN2DEC(“1011”), BIN2DEC(“1001”)), which evaluates to “1011” in binary or 11 in decimal.

Examples

In the following example, 9 in binary is “1001” and 5 in binary is 0101. The bitwise OR of 1001 and 0101 is 1101, which is 13 in decimal.

 AB
1FormulaResult
2=BITOR(9, 5)13

 

In this example, the bitwise OR of 1000 and 0001 is 1001, which is 9 in decimal:

 AB
1FormulaResult
2=BITOR(BIN2DEC(“1000”), BIN2DEC(“0001”))9

 

Related functions

  • BITAND: The BITAND function returns the bitwise boolean AND of two numbers. Learn more.
  • BITXOR: The BITXOR function is a bitwise XOR (exclusive or) of 2 numbers that returns a bit of “1” if 2 bits are different, and a bit of “0” otherwise.
  • BITLSHIFT: The BITLSHIFT function shifts the bits of the input a certain number of places to the left. Bits on the right are filled with zeroes (0s).
  • BITRSHIFT: The BITRSHIFT function shifts the bits of the input a certain number of places to the right.
  • BIN2DEC: The BIN2DEC function converts a signed binary number to decimal format.
  • DEC2BIN: The DEC2BIN function converts a decimal number to signed binary format.

Cite this article

stats writer (2024). How can I use the BITOR function in Google Sheets to perform a logical OR operation on two or more values?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-the-bitor-function-in-google-sheets-to-perform-a-logical-or-operation-on-two-or-more-values/

stats writer. "How can I use the BITOR function in Google Sheets to perform a logical OR operation on two or more values?." PSYCHOLOGICAL SCALES, 28 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-the-bitor-function-in-google-sheets-to-perform-a-logical-or-operation-on-two-or-more-values/.

stats writer. "How can I use the BITOR function in Google Sheets to perform a logical OR operation on two or more values?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-the-bitor-function-in-google-sheets-to-perform-a-logical-or-operation-on-two-or-more-values/.

stats writer (2024) 'How can I use the BITOR function in Google Sheets to perform a logical OR operation on two or more values?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-the-bitor-function-in-google-sheets-to-perform-a-logical-or-operation-on-two-or-more-values/.

[1] stats writer, "How can I use the BITOR function in Google Sheets to perform a logical OR operation on two or more values?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I use the BITOR function in Google Sheets to perform a logical OR operation on two or more values?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top