BITOR in Calligra Sheets: Combine Independent Status Flags
Combine numeric bit flags with BITOR in Calligra Sheets, with an auditable sample table, binary explanations, and compatibility limits.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in Calligra Sheets. How formula examples are checked
BITOR in Calligra Sheets
Quick answer
Use BITOR when two integer masks describe flags that should be combined: a bit stays 1 if it is 1 in either input. =BITOR(12;10) has the documented and independently checked expected result 14 (1100 OR 1010 = 1110), not a result observed in a Calligra application.
Exact syntax and argument order
=BITOR(number1;number2)
Both number1 and number2 are required whole-number values (cell references or integer literals). The first and second masks are symmetric: exchanging them does not change a bitwise OR. There is no optional argument in the official two-parameter registration. This operation differs from logical OR, which tests truth values rather than combining individual bits.
Evidence scope, release, locale and testing
Calligra’s English reference uses a semicolon (;) between parameters and ordinary decimal-point examples. Begin cell formulas with =. The notation here follows that documented English-language style. If a translated installation uses a different locale, check its function assistant and local number/separator conventions before copying formulas; this guide has not tested locale variants. The Calligra download page recommends Linux distribution packages or Flatpak and describes Windows as still being worked on. Other platforms and vendor builds were not tested. Function availability in the shipped source is not a promise about every installed package.
Step-by-step example: enter six input rows
Create a blank sheet. Put Number 1 (or Number) in A1, Number 2 (or Shift count) in B1, and Result in C1. Type these plain integers into A2:B7. In C2, type =BITOR(A2;B2) and fill down through C7. The table displays expected values from independent computation, not screenshots or observed app output.
| Row | A: Existing flags | B: New flags | C: Formula | Expected decimal | Expected binary |
|---|---|---|---|---|---|
| 2 | 12 | 10 | =BITOR(A2;B2) |
14 | 1100 OR 1010 = 1110 |
| 3 | 5 | 2 | =BITOR(A3;B3) |
7 | 101 OR 10 = 111 |
| 4 | 7 | 8 | =BITOR(A4;B4) |
15 | 111 OR 1000 = 1111 |
| 5 | 0 | 11 | =BITOR(A5;B5) |
11 | 0 OR 1011 = 1011 |
| 6 | 9 | 3 | =BITOR(A6;B6) |
11 | 1001 OR 11 = 1011 |
| 7 | 16 | 16 | =BITOR(A7;B7) |
16 | 10000 OR 10000 = 10000 |
Why the flags matter
Imagine three possible alerts are encoded as 1 (warning), 2 (service due), and 4 (review required). A device has flags 1 and 4 (mask 5), and a later check sets flag 2 (mask 2). =BITOR(5;2) produces 7, preserving all three bits. This is combining flags, not adding arbitrary numbers: BITOR(5;5) stays 5, whereas 5+5 is 10.
A cell-by-cell walkthrough: 12 is binary 1100; 10 is 1010. Compare each bit from right to left. At each position, choose 1 when either input has a 1. The combined 1110 represents 8+4+2, which equals 14.
Advanced example: merge three sources without double-counting
Suppose A2 contains 1, B2 contains 4 and C2 contains 8, representing three independent permissions. The nested formula
=BITOR(A2;BITOR(B2;C2))
has independently calculated expected result 13 (0001 OR 0100 OR 1000 = 1101). Each argument of each nested call is a whole number. The function accepts two arguments per call, so nesting is necessary to merge three cells this way; BITOR(A2;B2;C2) is not the documented syntax.
To ask whether a resulting mask contains the 4 bit, store the combined mask in D2 and use:
=BITAND(D2;4)>0
The result is expected TRUE when bit 4 is present. This uses the separately documented BITAND, which intersects rather than merges masks. Test this complete workflow in your target installation before relying on it for access controls; these are educational flag examples, not a security system.
Troubleshooting, errors and limits
- Confusing OR with addition:
BITOR(5;5)is 5, not 10. For counting totals, use arithmetic rather than bitwise flags. - Confusing BITOR with logical OR:
OR(TRUE;FALSE)checks conditions;BITOR(1;2)merges two integer masks to 3. - Fractional or textual inputs: The official XML classifies both arguments as integers. The handbook does not define how every noninteger text/fraction is coerced or which Calligra error it displays; supply explicit integers and verify any coercion in the application.
- Negative operands: The tagged C++ function converts operands to
uint64_t, combines them and casts toint64_t. Do not assume Excel’s negative-number rules or intuitive finite-bit representations apply; this guide intentionally uses nonnegative masks. - Extremely large masks: The handbook does not state a guaranteed bit width, upper bound or precision contract. For interoperable worksheets, keep masks small and exercise large values in all target applications before deployment.
- Unexpected result: Check missing leading
=, wrong cell references, decimal formatting, numeric rather than quoted values, and;vs the installation’s locale separator. No actual Calligra error code was observed for this guide.
Cross-software compatibility: Excel and LibreOffice Calc
Excel documents BITOR(number1,number2) for nonnegative operands and an input limit of 2^48-1, with specified errors for bad inputs. Calligra source uses a 64-bit unsigned intermediate then a signed return, but does not establish Excel-equivalent input validation or display behaviour. The illustrated small positive integer results are mathematically portable; negative operands, very large values, error codes and locales are not guaranteed equivalent. No LibreOffice Calc runtime test or up-to-date direct equivalent-function guarantee was established for this guide. See Microsoft’s official BITOR documentation for its distinct product-specific constraints; never transplant those restrictions into a Calligra claim without evidence.
Official reference and verification
- Calligra Sheets — function documentation
- KDE Sheets function handbook
- BITOR C++ registration and implementation
- bit operations XML
Verification status: Official documentation checked; example outcomes were independently reasoned or arithmetically checked where applicable. Not executed in Calligra Sheets.
- No genuine Calligra Sheets screenshots are included; this guide does not use mock application images.