BITOR Function
Combines the bits of two numbers (bitwise OR).
Category
Engineering
Available in
Excel 2013+, Microsoft 365
Returns
A whole number
Want to practice BITOR in a real spreadsheet? Open a blank sheet in our Practice Sandbox and try it with live data, with the AI Excel tutor beside you. No Excel needed — just a free account.Try it free in the Sandbox
Overview
BITOR compares two numbers in binary and returns a 1 in every position where either number has a 1.
Use it to switch flags on: BITOR(code, 2) turns on the 2 switch and leaves everything else as it was.
Syntax
=BITOR(number1, number2) Explain
Arguments
| Argument | Required? | What it does |
|---|---|---|
| number1 | Yes | The first whole number. |
| number2 | Yes | The second whole number. |
Examples
Example 1 — How the bits combine
Each row combines the two numbers bit by bit; the answer is shown as an ordinary decimal number.
C2fx=BITOR(A2,B2)
| A | B | C | |
|---|---|---|---|
| 1 | Number 1 | Number 2 | OR |
| 2 | 23 | 10 | 31 |
| 3 | 5 | 3 | 7 |
| 4 | 8 | 4 | 12 |
=BITOR(A2,B2) Explain
Example 2 — Give everyone Edit access
Edit is the 2 switch. People who already had it keep the same code.
C2fx=BITOR(B2,2)
| A | B | C | |
|---|---|---|---|
| 1 | Person | Code | New code |
| 2 | Ana | 13 | 15 |
| 3 | Ben | 3 | 3 |
| 4 | Di | 8 | 10 |
=BITOR(B2,2) Explain
Common mistakes
- #NUM! Both numbers must be whole numbers from 0 up to 2^48 − 1 (281,474,976,710,655). Negative numbers, decimals and bigger values return #NUM!.
- Using + instead. Adding 2 to a code that already has Edit (3 + 2 = 5) turns Edit off and Approve on by mistake. BITOR never does.
Notes
- Permission flags are a classic use: give each option a power of two (View = 1, Edit = 2, Approve = 4, Admin = 8) and store a person's access as one number — 13 means View + Approve + Admin.
- Related functions: BITAND, BITXOR, DEC2BIN.

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.