Contact

BITOR Function in ONLYOFFICE Spreadsheet Editor: Syntax and Practical Examples

Engineering Intermediate ONLYOFFICE Spreadsheet Editor

Bitwise OR merges separate nonnegative flag masks into one combined mask without adding shared flags twice. Use it for setting option flags, not summing quantities. Learn official syntax, reproducible worksheet examples, advanced applications, and verification limits.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Availability and version history

  • Introduced: The original introduction version and date are not established by the official sources checked.
  • Availability: Documented in the current ONLYOFFICE Spreadsheet Editor help; no final working-version endpoint is established.
  • Scope: Docs and Desktop Editors release separately. This unversioned help does not establish availability in every older build, mobile client or deployment.
  • Checked: October 14, 2026, against the official function reference. Documentation check; not a new native test.

Quick answer

Combine every bit position that is set in either decimal integer mask. The exact current English ONLYOFFICE formula signature is =BITOR(number1, number2). The function belongs to the Engineering category of ONLYOFFICE Spreadsheet Editor. Both parameters are required; there is no optional parameter or documented default. This syntax and the rule below come from the official ONLYOFFICE BITOR reference (checked 2026-10-13 UTC).

Verification: Worksheet and advanced results were independently calculated using exact integer arithmetic. Native ONLYOFFICE Docs or Desktop execution, localized input and historical-version compatibility were not tested.

What the function does, and when to use it

Bitwise OR merges separate nonnegative flag masks into one combined mask without adding shared flags twice. Use it for setting option flags, not summing quantities.

Official bit rule: A result bit is 1 when at least one corresponding input bit is 1. The vendor notes establish that operational description. They do not provide a complete specification of all width, overflow, coercion, locale, or legacy-version behaviors.

Bitwise operators compare binary positions rather than truth values of entire cells. For example, decimal 12 is binary 1100β‚‚ while decimal 10 is 1010β‚‚, so their bit positions can be compared individually. BITOR(12,10) is mathematically 14, represented as 1110β‚‚.

If you need to combine flags, BITOR adds all present bits; BITXOR highlights changed bits. BITAND keeps shared bits. All three are numerically distinct operations.

Understand the binary bits without typing binary literals

A bit is 0 or 1. The places in a binary numeral are valued at 1, 2, 4, 8, 16, 32, and so on from the rightmost place. As a result, 1100β‚‚ is 12 decimal, whereas 1010β‚‚ is 10 decimal. Subscript β‚‚ in the article is a mathematical label; do not paste it into a formula argument. Input 12 as the number twelve; do not enter the text string "1100" expecting ONLYOFFICE to parse it as binary.

For a two-mask operation, BOTH inputs are ordinary nonnegative decimal numbers. Their binary representations are shown solely to help you check which positions match, differ, or are present.

Exact syntax, argument order, and types

=BITOR(number1, number2)
Position Argument Required? Official ONLYOFFICE type/rule Default
1 number1 Required number1 β€” required numeric value in decimal form, greater than or equal to zero. No default; must be supplied.
2 number2 Required number2 β€” required numeric value in decimal form, greater than or equal to zero. No default; must be supplied.

No argument is optional. The first argument goes first even if you change the order of source columns. The official reference supplies neither an optional-width argument nor an optional mode selector for BITOR. Do not add brackets to the formula: they are a documentation convention used for some other functions, but not part of this function’s documented signature.

Type distinction: Both inputs are displayed as decimal numbers. They are not binary strings: for example, decimal 10 corresponds to binary 1010β‚‚. The sample values are all whole, nonnegative decimal integers, so the vendor’s stated >=0 requirements are respected.

The official formula-insertion guide describes using the Home or Formula tab and the search in Insert Function. The individual function article supplies the formula signature and notes used here.

Step-by-step worksheet: 20 reproducible test rows

Use a clean worksheet so no earlier sample values or formulas change these cell references:

  1. In A1 type Scenario, in B1 type First decimal mask, in C1 type Second decimal mask, in D1 type BITOR formula result, and in E1 type Independent expectation. Keep inputs in B and C as numeric cells, not binary strings.
  2. Populate A2:C21 with the input columns in the table below. Each B and C cell must contain the decimal integer displayed in the table. Column C is the shift count for the SHIFT functions; otherwise it is the second mask.
  3. In D2, type =BITOR(B2,C2) and press Enter. Use the fill handle to copy the same relative formula down through D21. For the comparisons, put the corresponding expected numbers from the table into E2:E21.
  4. Optional manual review column F: put =D2=E2 in F2 and copy down; a TRUE result would show equality in your own installed edition. This step has not been executed here, so don’t interpret it as a passed native test.
  5. When a result differs, record the app and version, Docs vs Desktop, locale, input cell type, exact formula text, and any displayed error. Compare the vendor argument rules first. Save your workbook if you decide to run the separate native-validation phase.

Inputs and independently expected outputs

Row Scenario B (decimal) C (decimal) Expected D B in binary Expected D in binary
2 Both zero 0 0 0 0 0
3 First bit only 1 0 1 1 1
4 Same lowest bit 1 1 1 1 1
5 Small overlapping flags 5 3 7 101 111
6 Two four-bit values 12 10 14 1100 1110
7 Single shared high bit 15 8 15 1111 1111
8 Sparse masks 42 21 63 101010 111111
9 Alternating bits 85 170 255 1010101 11111111
10 Upper-nibble mask 255 240 255 11111111 11111111
11 Lower-nibble mask 255 15 255 11111111 11111111
12 Separated high/low bits 1024 1 1025 10000000000 10000000001
13 Twelve-bit versus byte 4095 255 4095 111111111111 111111111111
14 Wide alternating mask 65535 43690 65535 1111111111111111 1111111111111111
15 Decimal example 99 72 107 1100011 1101011
16 Disjoint neighbor fields 7 8 15 111 1111
17 Almost same power of two 128 129 129 10000000 10000001
18 Complementary long masks 21845 43690 65535 101010101010101 1111111111111111
19 Top bit subset 1023 512 1023 1111111111 1111111111
20 Different selected flags 72 40 104 1001000 1101000
21 Overlapping byte fields 384 96 480 110000000 111100000

How to read the table: For every row, the independent calculation converted each B numeric input into binary, applied the documented bit position operation to nonnegative integral inputs, and converted the resulting binary integer back to decimal. The results are not a screenshot or native editor output.

Paste-ready formula checks

Formula typed into a spare cell Independent expected decimal value Result bits
=BITOR(0,0) 0 0
=BITOR(1,0) 1 1
=BITOR(1,1) 1 1
=BITOR(5,3) 7 111
=BITOR(12,10) 14 1110
=BITOR(15,8) 15 1111
=BITOR(42,21) 63 111111
=BITOR(85,170) 255 11111111
=BITOR(255,240) 255 11111111
=BITOR(255,15) 255 11111111

For a quick human cross-check, the example =BITOR(12,10) should produce 14 in the independent model, but this does not establish how untested versions calculate or format the result.

Advanced, practical applications

1. Enable two settings

Combine separate flags 4 and 8 to produce a decimal setting of 12.

  • Enter =BITOR(4,8). Independent expected result: 12, because 4 is 100β‚‚, the other mask is 8 (1000β‚‚), and the output is 1100β‚‚.
  • Enter =BITOR(12,2). Independent expected result: 14, because 12 is 1100β‚‚, the other mask is 2 (10β‚‚), and the output is 1110β‚‚.
  • Enter =BITOR(12,8). Independent expected result: 12, because 12 is 1100β‚‚, the other mask is 8 (1000β‚‚), and the output is 1100β‚‚.

A flag already enabled stays on; OR does not toggle an existing flag off.

2. Merge partial status summaries

Suppose one sensor sends a status mask of 5 (0101β‚‚) and another sends 10 (1010β‚‚).

  • Enter =BITOR(5,10). Independent expected result: 15, because 5 is 101β‚‚, the other mask is 10 (1010β‚‚), and the output is 1111β‚‚.
  • Enter =BITOR(85,170). Independent expected result: 255, because 85 is 1010101β‚‚, the other mask is 170 (10101010β‚‚), and the output is 11111111β‚‚.
  • Enter =BITOR(7,8). Independent expected result: 15, because 7 is 111β‚‚, the other mask is 8 (1000β‚‚), and the output is 1111β‚‚.

The merged result tells you which bits were present in either input, not which source set them.

3. Avoid double-counting overlapping flags

Decimal 12 (1100β‚‚) and decimal 10 (1010β‚‚) share one bit.

  • Enter =BITOR(12,10). Independent expected result: 14, because 12 is 1100β‚‚, the other mask is 10 (1010β‚‚), and the output is 1110β‚‚.
  • Enter =BITOR(15,8). Independent expected result: 15, because 15 is 1111β‚‚, the other mask is 8 (1000β‚‚), and the output is 1111β‚‚.
  • Enter =BITOR(255,240). Independent expected result: 255, because 255 is 11111111β‚‚, the other mask is 240 (11110000β‚‚), and the output is 11111111β‚‚.

Ordinary arithmetic addition would double-count shared bits; OR returns their union.

Compare BITOR with other operations

Do not substitute arithmetic + or the logical OR(…) function when you want a bit mask; shared bit positions make addition and bitwise OR different.

A few identities help detect mistakes before putting a bit mask in production. The following are mathematical rules on nonnegative integers, not a vendor-issued runtime promise about unlimited precision:

  • BITAND(a,b), BITOR(a,b), and BITXOR(a,b) are different ways to compare two masks: shared, any, and differing bits respectively.
  • a OR b = (a XOR b) + (a AND b) mathematically. This helps distinguish mask merging from regular decimal addition, which treats overlapping bits differently.
  • For nonnegative integer n and nonnegative count k, shifting left is n Γ— 2^k, while shifting right is the whole-number quotient of n Γ· 2^k; this relationship explains the examples but says nothing about the editor’s maximum supported width.
  • If you combine mask operations, keep the original decimal inputs in separate source columns. Do not overwrite raw device statuses, access codes or source measurements with computed flags; a conversion can hide which source contributed a bit.

Important note about leading zeros and signed values

A plain numeric cell stores a number, not a fixed-length binary string. Leading zeros may be meaningful in a hardware protocol but are not represented by these arithmetic examples. A negative signed integer uses representation conventions that are not specified in the checked BITOR reference. If your task needs a signed two’s-complement width, choose and document the protocol width separately and test the actual ONLYOFFICE version before claiming parity with another system.

Error conditions, documentation gaps and troubleshooting

The official BITOR help page specifies the allowed argument category and the bit rule, but it does not list a complete table of runtime error codes. The following problematic inputs are review cases, not errors observed in an editor. Never present #NUM!, #VALUE!, #NAME?, or a truncation rule as a verified result unless separately established from a relevant official source or native test.

Formula / diagnostic case What the official rule or reference establishes What still needs checking
=BITOR(-1,3) Vendor requires both inputs to be at least zero. Negative input violates the documented domain; exact error token not observed.
=BITOR(3.5,1) Vendor calls each argument a numeric decimal value but does not specify fraction handling. Do not assume flooring, coercion or a particular error code.
=BITOR("1010",3) Quoted text resembles a decimal number, not a declared binary string. Text-to-number coercion not verified; use numeric decimal source cells.
=BITOR(0,0) Documented nonnegative domain satisfied. Independent mathematical expectation: 0; verify if needed in an installed edition.
=BITOR(999999999999,1) No exact supported bit width or precision rule supplied by this help article. Avoid large-integer claims before native precision/range tests.

What to check if your result surprises you:

  1. Confirm BITOR is selected, rather than an adjacent name such as XOR, AND or OR with different semantics. The vendor lists this function under Engineering.
  2. Verify numeric input values in decimal, including negative signs, decimal fractions, empty cells, and pasted strings. The clean worked table uses only integral nonnegative numeric values.
  3. Verify argument order and exactly two comma-separated arguments in the English reference. The current formula UI instructions illustrate function insertion; locale-specific separators and labels must be checked in the target editor.
  4. For a shift, confirm that C2 is an integer count of binary positions, not a request for the number of output characters. For a mask operation, C2 is a second decimal mask, not a shift count.
  5. Prefer smaller sample integers while checking a version-specific maximum width. Exact overflow rules, boundaries and floating-point precision need native validation rather than assumptions borrowed from another spreadsheet.
  6. Preserve the formula, input types and installed build number in any issue report. No vendor error screenshots were captured; any formula returning a displayed error in a reviewer’s editor must be reported with that editor version before recording an exact error token.

Compatibility checks for your installation

  • Recreate each of the 20 safe rows in a specifically identified ONLYOFFICE Docs web version and record actual cell values.
  • Repeat selected boundary cases in a specifically identified Desktop Editors build, noting operating system and file format.
  • Check invalid negatives, fractions, blank/text cells and large values, and capture actual error tokens only after reproducible execution.
  • Check decimal separators, argument separators and localized function naming, using an actual non-English regional configuration.
  • Test save/reopen and export compatibility; an XLSX round-trip in another program would not alone establish that ONLYOFFICE executed the formula identically.

ONLYOFFICE platform, release, regional-language and compatibility notes

The guide is vendor-specific: ONLYOFFICE’s English Insert Functions catalogue lists this as an engineering function with its current unversioned online help. The same title does not establish a release-specific compatibility matrix or version of the calculation engine.

Web/Docs versus Desktop Editors: The official ONLYOFFICE Docs changelog lists Docs 10.0.0 released October 10, 2026. The separate Desktop Editors changelog lists Desktop Editors 9.4.0 released May 19, 2026 in its release history. The official Desktop GitHub release history also lists 10.0.0 released 13 October 2026. These pages are two different products’ release histories. Neither checked page identifies the first Docs or Desktop release supporting BITOR, and neither demonstrates a native execution of our examples. Treat old editions and shared XLSX compatibility as not verified, not automatically equivalent.

Formula syntax/locales: The examples use the English-language function spelling, an = prefix, the comma between two arguments shown in the official reference, and a period only in English explanatory numbers where needed. ONLYOFFICE offers additional Spreadsheet Editor advanced settings; do not assume this English formula can be pasted unchanged in every language or region. The function’s region-specific label and formula-argument separator were not tested in a running editor.

Validation boundaries: The vendor documents syntax and the basic operation; our mathematical verification confirms examples independently. Neither source type establishes installed behavior for fractions, negative counts, large bit widths, signed integers or cross-edition coercion. Those claims remain explicitly unverified.

The following links lead to official ONLYOFFICE references:

Sources and verification limits

  • Primary claim-level source: ONLYOFFICE BITOR reference β€” title, purpose, exact two-argument signature, argument conditions and bit-operation notes; inspected 2026-10-13 UTC.
  • Official UI context: Inserting functions and Advanced Settings; checked 2026-10-13 UTC.
  • Official release context: Docs changelog and Desktop changelog; checked 2026-10-13 UTC, with desktop/web differences explicitly unresolved.
  • Independent numerical verification: the examples were generated and cross-checked using Python exact integers and the algebraic relationships described above. a & b for BITAND, a | b for BITOR, a ^ b for BITXOR, a << k for left shift, and a >> k for right shift are used only as independent mathematical models on the safe nonnegative integral samples.
  • Missing verification: No native ONLYOFFICE execution (Docs or Desktop), no captured error messages, no screenshot, no localized editor run, no historical-version compatibility testing.

Last official source check: 2026-10-13 UTC. Guide research status: official-reference checked; independently calculated; native editor execution not performed.