BITOR in WPS Spreadsheet: Apply Bitwise Or to Integer Flags
Use BITOR in WPS Spreadsheet with original bit-mask examples, the documented 48-bit integer domain and explicit error rules.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: BITOR performs bitwise OR on two nonnegative decimal integers and returns a decimal integer. =BITOR(13,10) is expected to return 15. A result bit is 1 when either input bit at that position is 1, including when both are 1.
Syntax and accepted inputs
=BITOR(number1,number2)
Both arguments are required. The official WPS lesson requires integers from 0 through 281474976710655, inclusive; the upper limit is 2^48−1. Enter ordinary decimal integer values. The function interprets their bits internally; it does not return a string of binary digits.
A value such as decimal 13 corresponds to binary 1101. Entering the decimal number 1101 instead supplies a different integer, not a declaration that the digits are binary. Use a conversion function when the source data is genuinely binary text, and check that its signed convention is suitable.
Worked example: inspect every bit
- On a fresh worksheet, enter the number 13 in A2 and 10 in B2.
- Enter
=BITOR(A2,B2)in C2. - The independent expected result is 15. Display it as an ordinary number rather than a date or percentage.
- Check the four positions with weights 8, 4, 2 and 1:
| Weight | Bit in 13 | Bit in 10 | Bitwise OR result |
|---|---|---|---|
| 8 | 1 | 1 | 1 |
| 4 | 1 | 0 | 1 |
| 2 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
Sum the weights whose result bit is 1 to obtain 15. This is a position-by-position calculation, not arithmetic multiplication, addition or a Boolean TRUE/FALSE test. Leading zero positions above weight 8 contribute nothing in this example.
Practical application: flag values
Suppose configuration 13 enables weights 1, 4 and 8, and a second configuration 10 enables weights 2 and 8. =BITOR(13,10) produces 15, combining all four weights without counting weight 8 twice. Ordinary addition gives 23 and is not a replacement for OR when flags overlap.
To ensure that weight 2 is enabled, =BITOR(13,2) gives 15. Applying that same mask again leaves the result at 15: enabling an already enabled bit does not toggle it off. OR only adds enabled positions in this nonnegative-integer model; it is not a method for clearing a flag. For more than two inputs, combine two at a time and keep each intermediate integer within the documented domain.
Boundary controls and documented errors
| Formula | Expected result | Explanation |
|---|---|---|
=BITOR(0,13) |
13 | Apply the operation to an all-zero input |
=BITOR(13,13) |
13 | Matching input positions |
=BITOR(281474976710655,1) |
281474976710655 | Inclusive 48-bit maximum |
=BITOR(-1,1) |
#NUM! |
Negative argument |
=BITOR(1.5,1) |
#NUM! |
Fractional argument |
=BITOR(281474976710656,1) |
#NUM! |
One above the maximum |
=BITOR("bad",1) |
#VALUE! |
Nonnumeric argument |
These error categories are explicitly documented by WPS. In particular, the lesson specifies rejection of fractions, rather than truncation. Changing a cell’s displayed decimal places does not make its stored fractional value an integer.
Troubleshooting and portability
Keep imported flag values as exact integers and validate them before applying the operation. The bounded domain has 48 bit positions; do not assume that negative values use the same signed representation as BIN2DEC, or that a programming language’s arbitrary-width integer rules apply.
The cited lesson does not resolve blank-cell treatment, logical-value coercion, numeric text, array arguments, omitted arguments or error precedence when both inputs are invalid. The examples therefore use explicit numeric scalars and one clearly invalid input at a time. No runtime behavior is inferred for those additional cases.
A decimal output can still be a bit mask. If a report labels the result as an amount or a count, its interpretation will be misleading. Preserve a flag legend and distinguish the raw integer from a human-readable list of enabled options.
Evidence, availability and compatibility
The official WPS Academy BITOR lesson, published 2019-06-11, is the product-specific source for this guide. It was reviewed on October 18, 2026. Its applicability field does not specify an edition, platform or numeric build. General platform links in the website footer do not establish applicability. The publication date establishes that the function was documented by that date; the first release and last supported version remain unknown. The cited lesson does not identify the function as deprecated or retired.
The examples are original, independently calculated expectations based on that documented contract. They were not executed in WPS, and no application screenshot is presented. Before exchanging a workbook, check the formula in the intended WPS edition and locale. These examples use the lesson’s English function names and comma separators; localized entry and file-format round trips have not been tested.