Google Sheets BITAND Function: Syntax, Examples & Tips

The BITAND function computes the bitwise AND of two numbers, returning a number that has bits set to 1 where both inputs have bits set to 1.
Google Sheets
BITAND(value1, value2)

One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.

On this page
  1. Parameters
  2. What is a BITAND?
  3. A Practical Example
  4. BITAND Formula
  5. Result of the Formula
  6. Why Use BITAND?
  7. Key Takeaways:
  8. Example use case

Parameters

value1:
The first value or bitwise expression that you want to evaluate in the BITAND operation. This can be a number, a cell reference, or a formula that returns a number.

value2:
The second value or bitwise expression that you want to evaluate in the BITAND operation. This can also be a number, a cell reference, or a formula that returns a number.

What is a BITAND?

The BITAND function in Google Sheets is a bitwise operation tool that allows you to perform a logical AND operation on two numbers at the bit level. This function is particularly useful when working with binary data or when you need to manipulate flags represented as bits. By using BITAND, you can determine which bits are set in both numbers, providing a way to analyze and compare binary values.

In simpler terms, BITAND helps you to compare two numbers and find out which bits they have in common.

A Practical Example

Imagine you are managing user permissions in a system where each permission is represented by a specific bit in a binary number:

Permissions Table:

UserIDPermissions
16
25
33

In this example, the permissions are represented as follows:

  • Bit 1: Read
  • Bit 2: Write
  • Bit 3: Execute

You want to check if User 1 and User 2 have the same permissions.

BITAND Formula

To achieve this, you would use the BITAND function as follows:

Google Sheets
=BITAND(A2, A3)

In this formula:

  • A2 is the cell containing the Permissions for User 1 (6).
  • A3 is the cell containing the Permissions for User 2 (5).

Result of the Formula

When you apply the BITAND formula, the output would be:

UserIDPermissionsBITAND Result
164
25

The BITAND result of 4 (binary: 100) indicates that both users have the "Execute" permission (the third bit).

Why Use BITAND?

BITAND is beneficial because it allows for efficient manipulation and comparison of binary data. It simplifies the process of checking multiple flags or permissions without needing to convert values to binary manually. This function is particularly useful in scenarios involving user permissions, feature toggles, or any application where binary representation is key.

Key Takeaways:

  • BITAND: A function that performs a bitwise AND operation on two numbers.
  • Binary Comparison: Useful for comparing permissions or flags represented as bits.
  • Efficiency: Simplifies the process of analyzing binary data without manual conversion.
  • Common Use Cases: Ideal for user permission management, feature toggles, and any scenario involving binary data manipulation.

BITAND is an essential function for anyone working with binary data in Google Sheets, providing a powerful way to enhance data analysis and decision-making capabilities.

Happy spreadsheeting!

Example use case

You have a table where Column A contains binary flags for project participation and Column B contains employee IDs. You can use BITAND to check if an employee is part of multiple projects by comparing their flags, streamlining project management.

Need more help with Google Sheets formulas?

Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.

Explore all Google Sheets formulas

Browse our complete library of Google Sheets formula guides

Compare your options

Decide with evidence, not a sales pitch.

Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.

  1. 01ChatGPTOpen a balanced comparison prompt in ChatGPT.
  2. 02ClaudeOpen the same research prompt in Claude.
  3. 03PerplexityResearch the comparison with linked web sources.

AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.