BITOR Function

BITOR Function

BITOR Function

Perform a bitwise OR operation on two integers. Useful for turning flags on, combining masks, and building up bit-based values.

ExcelClash Team
PUBLISHED

Summary

BITOR compares two integers at the bit level and keeps any bit that is 1 in either value. If a bit is on in one input or both inputs, it stays on in the result.

This makes BITOR useful when you want to turn flags on or combine several bit-based values into one number. It is a safer fit than normal addition when you are working with flags, because it keeps existing bits on instead of changing the meaning through carry rules.

Purpose

Combine bits

Returns any bit that is on in either input.

Return value

Number

Returns the decimal value of the combined bit pattern.

Syntax

=BITOR(number1, number2)

number1 and number2 are the integers you want to combine.

Excel checks both binary patterns and turns a bit on in the result if either input has that bit on. The final answer is returned as a decimal number, so the function feels like normal Excel output even though it is doing bitwise logic underneath.

Arguments

  • number1 - [required] The first non-negative integer.
  • number2 - [required] The second non-negative integer.

Both arguments must be whole numbers that are 0 or larger. These are usually ordinary decimal values used as flag containers. If either input is negative, too large, or not numeric, Excel returns an error instead of performing the bitwise OR.

BITOR vs similar functions

BITOR is for turning bits on, not for checking overlap or toggling changes:

Function What it does Typical use Result
BITOR Keeps any bit that is on in either input Turn flags on or combine masks Number
BITAND Keeps only shared bits Check whether a flag is set Number
BITXOR Keeps only different bits Toggle or compare changes Number
+ Adds numbers normally Regular arithmetic Number

Using BITOR

The main use is turning on one or more target bits. If a bit is already on, BITOR leaves it on. If it is off and the mask includes that bit, BITOR turns it on. That makes it a good fit when you want to enforce a state without first checking every bit manually.

This is especially useful for flags and permissions. A value like BITOR(1, 2) combines two separate permission bits into 3. More importantly, if one of those bits is already present, BITOR does not break the value by adding it twice.

Excel's bitwise functions work with non-negative integers and support values up to 2^48 - 1. If the inputs go outside that range, Excel returns #NUM!.

Example 1 - Combine 13 and 8

This keeps any bit that is on in either value.

=BITOR(13, 8) // Returns 13
Check Answer
Challenge #1
Target: Sheet1!F1
Simple Logic Union

Find the bitwise OR of 13 and 8. Formula: =BITOR(13, 8).

Example 2 - Turn on two flags

This combines two separate bit values into one result.

=BITOR(8, 16) // Returns 24
Check Answer
Challenge #2
Target: Sheet1!F2
Compound Flag Setting

Set bit 4 (8) and bit 5 (16) in a new word. Formula: =BITOR(8, 16).

Example 3 - Combine permission bits

This is a simple way to build a combined permission value.

=BITOR(1, 2) // Returns 3
Check Answer
Challenge #3
Target: Sheet1!F3
Permission Accumulation

Combine Read (1) and Write (2) for a user. Formula: =BITOR(1, 2).

Example 4 - Force one high bit on

This adds the target bit without changing unrelated bits.

=BITOR(1024, 1) // Returns 1025
Check Answer
Challenge #4
Target: Sheet1!F4
48-Bit Capacity Check

Perform OR on 1024 and 1. Formula: =BITOR(1024,1).

Quick recap

  • Keeps any on bit: BITOR returns the union of the two bit patterns.
  • Useful for enabling flags: It is a clean way to force a bit on.
  • Better than plain addition for flags: It avoids changing meaning through duplicate adds.
  • Returns a number: The result is a decimal value, not a boolean.
  • Works only with non-negative integers: Excel returns #NUM! for values outside the supported range.
Tactical Arena
Select Scenario:
Share BITOR Function!

Tell your friends about this post

Discussion

ExcelClash is an interactive platform designed to level up your Excel skills through real-world exercises and challenges. Sharpen your logic, solve real spreadsheet problems, and learn faster.

© 2026 ExcelClash, Inc. All rights reserved.