How can I use the BITAND function in Google Sheets?

How can I use the BITAND function in Google Sheets?

The BITAND function in Google Sheets allows users to perform bitwise AND operations on binary numbers. This function takes two binary numbers as inputs and returns the result of their bitwise AND operation. It can be used for various purposes such as checking for specific bit patterns, comparing binary values, and converting binary numbers to decimal numbers. To use the BITAND function, users must follow the correct syntax and provide the binary numbers in the specified format. This function can be useful for working with binary data and performing complex calculations in Google Sheets.

BITAND function

The BITAND function returns the bitwise boolean AND of two numbers. Learn more. The truth table of BITAND is provided below:
ABBITAND(A,B)
000
010
100
111

Parts of a BITAND function

BITAND(value1,value2)

PartDescriptionNotes
value1The first number.Must be the decimal representation of the number.
value2The second number.Must be the decimal representation of the number.

Notes

It may make sense to use BITAND in conjunction with BIN2DEC as follows:

  • BITAND(BIN2DEC(“1010”), BIN2DEC(“1001”)) which evaluates to “1000” in binary or 8 in decimal.

Examples

10 in decimal is “1010” in binary. 9 in decimal is “1001” in binary. The result is “1000” in binary, which is 8 in decimal.

 AB
1FormulaResult
2=BITAND(10,9)8

 

The bitwise boolean AND of binary numbers “1110” and “0100” is the binary number “0100”, which is 4 in decimal.

 AB
1FormulaResult
2=BITAND(BIN2DEC("1110"), BIN2DEC("0100"))4

Related functions

  • BITOR: The BITOR function returns the bitwise boolean OR of two numbers.
  • BITXOR: The BITXOR function returns the bitwise boolean XOR (exclusive OR) of two numbers.
  • 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. Bits on the right are filled with zeroes (0s).
  • 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 BITAND function in Google Sheets?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-the-bitand-function-in-google-sheets/

stats writer. "How can I use the BITAND function in Google Sheets?." PSYCHOLOGICAL SCALES, 28 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-the-bitand-function-in-google-sheets/.

stats writer. "How can I use the BITAND function in Google Sheets?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-the-bitand-function-in-google-sheets/.

stats writer (2024) 'How can I use the BITAND function in Google Sheets?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-the-bitand-function-in-google-sheets/.

[1] stats writer, "How can I use the BITAND function in Google Sheets?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I use the BITAND function in Google Sheets?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

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