Contact

BOOL2INT in Calligra Sheets: Syntax, Examples and Source-Level Pitfalls

Conversion Beginner Calligra Sheets

Convert TRUE and FALSE into integer flags (1 and 0) with reusable quality-control examples.

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

Quick answer

=BOOL2INT(TRUE) has a documented and source-supported expected result of 1, while =BOOL2INT(FALSE) has expected result 0. Use BOOL2INT when a logical check should produce a numeric 0/1 indicator that you can add, average or export as a numeric flag. These are expected results, not results observed in Calligra at runtime. [E1, E2, E3]

What BOOL2INT is for

A row-by-row quality-control worksheet might mark whether each inspection passed. A readable Boolean column shows TRUE or FALSE, while a second numeric column lets you total the number of passing records. BOOL2INT explicitly converts each Boolean to integer 1 or 0 instead of relying on implicit arithmetic coercion.

Exact syntax, arguments and defaults

=BOOL2INT(value)

The sole, required value is a Boolean (TRUE/FALSE) according to Calligra’s function XML and handbook. The function returns an integer. There is one argument, in position 1; no optional arguments or defaults are documented. Its registered callback calls calc->conv()->asInteger(args[0]); the pinned converter maps a typed Boolean TRUE to integer 1 and FALSE to integer 0. [E1, E2, E3]

Use a Boolean-typed cell or logical expression such as A2>0, not the text string "TRUE" unless you have separately verified text coercion. A string literal and a Boolean value are different spreadsheet data types; error displays for invalid arguments were not tested natively.

Reproducible worksheet: count completed jobs

Enter the following inputs. A2:A6 contains numeric completed hours, not text. B2:B6 uses formulas; all results shown are independently expected. [E4]

Cell Input or formula Independently expected result
A2 2 2
A3 0 0
A4 5 5
A5 -1 -1
A6 8 8
B2 =A2>0 TRUE
B3 =A3>0 FALSE
B4 =A4>0 TRUE
B5 =A5>0 FALSE
B6 =A6>0 TRUE

Put =BOOL2INT(B2) in C2 and fill down through C6. Expected C2:C6 are 1, 0, 1, 0, 1. =SUM(C2:C6) in D2 should therefore return 3, equal to the number of positive-hour rows; =AVERAGE(C2:C6) in D3 has expected value 0.6 (3/5). No formula was run in the application. [E1, E3, E4]

If you do not need intermediate Boolean cells, enter =BOOL2INT(A2>0) in C2 instead. Filling down should give the same expected flags because a comparison creates a Boolean value.

Advanced case 1: test two requirements together

In E2 enter =BOOL2INT(AND(A2>0;A2<6)); for A2=2, the independent expected output is 1. If A4=5 it is 1; for A6=8 it is 0 because 8 is not less than 6. Here the two-argument AND uses the semicolon convention in English KDE examples; locale-specific separators may vary. A logically equivalent numerical approach for a validated 0/1 expression is =IF(AND(A2>0;A2<6);1;0). The relationship is a logic identity, not proof of identical handling of non-Boolean types. [E1, E4]

Advanced case 2: interchange with INT2BOOL

=BOOL2INT(INT2BOOL(1)) has independently expected output 1, and =BOOL2INT(INT2BOOL(0)) has 0. The pinned source maps integer 1/0 to Boolean then Boolean back to integer. For integers other than 0/1, see the INT2BOOL documentation discrepancy: KDE prose says only 0 or 1 are accepted, whereas pinned converter source maps any nonzero typed integer to TRUE. Do not assume round-trip identity for arbitrary integers. [E1, E2, E3]

Troubleshooting, types and limitations

  • Flags look like text: Check that the input cells are logical values rather than quoted text "TRUE" or "FALSE". The XML parameter is Boolean; conversion of an invalid text argument was not validated in a running application. [E1]
  • Flags do not match your intended rule: >0 means positive, not nonzero. For a pass/fail column where negatives should also count as nonzero, consider <>0 instead of >0 and document that rule. [E4]
  • One missing parameter / too many: The official signature has exactly one required Boolean input. =BOOL2INT() and extra-argument forms are outside the documented signature. Do not invent their native error messages. [E1]
  • Unexpected locale output: The integer result itself is 0 or 1, but Boolean literal names and separators may be localized. The text conversion done by BOOL2STRING is explicitly locale-aware. [E3]
  • Numbers or errors passed directly: Source-level converter implementation handles several typed cases; official parameter metadata still specifies Boolean. Exact evaluator validation and displayed error labels for non-Boolean input remain untested; prefer explicit comparisons. [E1, E3]

Cross-software formula migration

Do not assume Excel, LibreOffice Calc, Apple Numbers or Google Sheets accept BOOL2INT as the same named function. For a Boolean in A2, the mathematical rewrite =IF(A2;1;0) expresses the 1/0 mapping using basic logic; check the destination program’s separator and Boolean syntax before importing. =IF(A2>0;1;0) likewise expresses a numeric threshold. The rewrite does not guarantee identical treatment of blank cells, text or errors, none of which were tested across applications. [E4]

Frequently asked questions

Does BOOL2INT change the original cell? No. The formula calculates a value in its own cell from the referenced input; it does not edit the source cell.

Can I count TRUE values? For valid Boolean inputs, converting each to 1 or 0 and summing the results gives an expected TRUE count. The worked dataset yields 3. [E3, E4]

Is BOOL2INT the same as BOOL2STRING? No. BOOL2INT returns an integer; BOOL2STRING returns a localized text representation. [E1, E3]

Version, scope and validation

This tutorial concerns Calligra Sheets source release 26.08.2, published 8 October 2026; research accessed 2026-10-12 (UTC). The source revision is 72123cc643f6625351139e7df294544255a1056f. The registration exists in the pinned conversion module, but that alone does not establish functionality in every operating-system package, language configuration or older edition. [E2, E5]

Validation terminology: DOC means official handbook/XML checked; SOURCE means pinned C++ read; CALC means simple independent Boolean/numeric logic checked; NATIVE means observed in a running Calligra Sheets installation. Status here: DOC yes; SOURCE yes; CALC yes; NATIVE no. All formula results are expected, not native-observed.

KDE’s English examples use TRUE/FALSE and semicolons to separate arguments (for formulas requiring more than one). Boolean display text, decimal entry and argument separators can vary with locale. A single-argument formula itself requires no separator. For cross-application migration, do not assume the same-named function or its edge-case handling is available elsewhere.

Useful neighboring functions are BOOL2INT, INT2BOOL, BOOL2STRING, IF, AND, OR and NOT. Their names are present in KDE’s registered function catalogue. See the official BOOL2INT, BOOL2STRING, INT2BOOL and IF entries. Links point to the official KDE references. [E1]

Official sources and claim-level evidence