Contact

BITXOR Function in ONLYOFFICE Spreadsheet Editor: Syntax and Practical Examples

Engineering Intermediate ONLYOFFICE Spreadsheet Editor

Bitwise exclusive OR marks a bit when exactly one of the two inputs has that bit on. It is useful for detecting changes between flag snapshots or toggling a selected set of bits. Learn official syntax, reproducible worksheet examples, advanced applications, and verification limits.

Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in ONLYOFFICE Spreadsheet Editor. How formula examples are checked

Quick answer

Show which bit positions differ between two decimal integer masks. The exact current English ONLYOFFICE formula signature is =BITXOR(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 BITXOR 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 exclusive OR marks a bit when exactly one of the two inputs has that bit on. It is useful for detecting changes between flag snapshots or toggling a selected set of bits.

Official bit rule: A result bit is 1 when the corresponding input bits are different, and 0 when they match. 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. BITXOR(12,10) is mathematically 6, represented as 110â‚‚.

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

=BITXOR(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 BITXOR. 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 BITXOR 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 =BITXOR(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 0 1 0
5 Small overlapping flags 5 3 6 101 110
6 Two four-bit values 12 10 6 1100 110
7 Single shared high bit 15 8 7 1111 111
8 Sparse masks 42 21 63 101010 111111
9 Alternating bits 85 170 255 1010101 11111111
10 Upper-nibble mask 255 240 15 11111111 1111
11 Lower-nibble mask 255 15 240 11111111 11110000
12 Separated high/low bits 1024 1 1025 10000000000 10000000001
13 Twelve-bit versus byte 4095 255 3840 111111111111 111100000000
14 Wide alternating mask 65535 43690 21845 1111111111111111 101010101010101
15 Decimal example 99 72 43 1100011 101011
16 Disjoint neighbor fields 7 8 15 111 1111
17 Almost same power of two 128 129 1 10000000 1
18 Complementary long masks 21845 43690 65535 101010101010101 1111111111111111
19 Top bit subset 1023 512 511 1111111111 111111111
20 Different selected flags 72 40 96 1001000 1100000
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
=BITXOR(0,0) 0 0
=BITXOR(1,0) 1 1
=BITXOR(1,1) 0 0
=BITXOR(5,3) 6 110
=BITXOR(12,10) 6 110
=BITXOR(15,8) 7 111
=BITXOR(42,21) 63 111111
=BITXOR(85,170) 255 11111111
=BITXOR(255,240) 15 1111
=BITXOR(255,15) 240 11110000

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

Advanced, practical applications

1. Detect a changed status bit

Compare successive decimal status masks 12 (1100â‚‚) and 10 (1010â‚‚).

  • Enter =BITXOR(12,10). Independent expected result: 6, because 12 is 1100â‚‚, the other mask is 10 (1010â‚‚), and the output is 110â‚‚.
  • Enter =BITXOR(85,170). Independent expected result: 255, because 85 is 1010101â‚‚, the other mask is 170 (10101010â‚‚), and the output is 11111111â‚‚.
  • Enter =BITXOR(128,129). Independent expected result: 1, because 128 is 10000000â‚‚, the other mask is 129 (10000001â‚‚), and the output is 1â‚‚.

A nonzero result identifies changed positions but not their direction; compare the old and new mask to learn which flags turned on.

2. Toggle a single bit

A mask of 4 flips only the 0100â‚‚ bit in decimal 12.

  • Enter =BITXOR(12,4). Independent expected result: 8, because 12 is 1100â‚‚, the other mask is 4 (100â‚‚), and the output is 1000â‚‚.
  • Enter =BITXOR(8,4). Independent expected result: 12, because 8 is 1000â‚‚, the other mask is 4 (100â‚‚), and the output is 1100â‚‚.
  • Enter =BITXOR(0,4). Independent expected result: 4, because 0 is 0â‚‚, the other mask is 4 (100â‚‚), and the output is 100â‚‚.

Applying the identical XOR mask twice restores the original value mathematically.

3. Compare two configuration snapshots

Suppose yesterday’s permission mask was 255 and today’s mask 240.

  • Enter =BITXOR(255,240). Independent expected result: 15, because 255 is 11111111â‚‚, the other mask is 240 (11110000â‚‚), and the output is 1111â‚‚.
  • Enter =BITXOR(65535,43690). Independent expected result: 21845, because 65535 is 1111111111111111â‚‚, the other mask is 43690 (1010101010101010â‚‚), and the output is 101010101010101â‚‚.
  • Enter =BITXOR(5,5). Independent expected result: 0, because 5 is 101â‚‚, the other mask is 5 (101â‚‚), and the output is 0â‚‚.

A value of zero means identical bit patterns for the compared integers, not that the wider data records are identical.

Compare BITXOR with other operations

BITXOR and XOR are different function names: BITXOR is an engineering bitwise function; ONLYOFFICE separately documents XOR as a logical function.

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 BITXOR 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 BITXOR 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
=BITXOR(-1,3) Vendor requires both inputs to be at least zero. Negative input violates the documented domain; exact error token not observed.
=BITXOR(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.
=BITXOR("1010",3) Quoted text resembles a decimal number, not a declared binary string. Text-to-number coercion not verified; use numeric decimal source cells.
=BITXOR(0,0) Documented nonnegative domain satisfied. Independent mathematical expectation: 0; verify if needed in an installed edition.
=BITXOR(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 BITXOR 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 BITXOR, 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 BITXOR 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.