TOGGLE in Calligra Sheets: Reverse Uppercase and Lowercase
Learn how to reverse text letter case with Calligra Sheets TOGGLE, including repeatable formulas, Unicode cautions and spreadsheet comparisons.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: =TOGGLE("HeLlO") is expected to return hElLo, changing uppercase letters to lowercase and lowercase letters to uppercase. The official KDE documentation includes this example and also shows TOGGLE("hello") → HELLO and TOGGLE("HELLO") → hello. This is a reverse-case function, not an all-uppercase title formatter.
Version scope: Official Calligra 26.08.2 source, released 2026-10-08, plus stable KF6 English documentation, accessed 2026-10-12. The examples were independently checked for ordinary ASCII Latin letters and punctuation against the pinned source. They are expected outputs, not observations from a running Calligra program.
Availability and version history
- Introduced: Documented by 26.08.2; original introduction not established.
- Availability: Supported in Calligra Sheets 26.08.2, based on the function-specific registration.
- Scope: The official application listing provides Linux installation; other packaged builds are unverified here.
- Checked: October 14, 2026. Documentation/source check; no new native test in Calligra Sheets 26.08.2.
What TOGGLE is useful for
TOGGLE is a quick way to invert capitalization in copied headings, identifier labels or mixed-case text. It applies case reversal across the string rather than only its first letter or each word’s first letter. LOWER("Hello") produces lowercase, and UPPER("Hello") produces uppercase; TOGGLE("Hello") is expected to produce hELLO, preserving the pattern but inverted. This makes it an unusual but useful transformation in text-cleanup tasks or case-sensitive demonstrations.
TOGGLE is not intended as reliable normalization to title case, sentence case or a canonical casing system. For consistent uppercase data, use UPPER; for lowercase, use LOWER. The exact handling of more complex scripts and case-expanding Unicode sequences needs testing beyond basic ASCII.
Exact syntax, argument type and version details
=TOGGLE(text)
| Parameter | Required | Official XML type | Description | Default |
|---|---|---|---|---|
text |
Yes | String | Text or cell reference whose letter case is inverted | None |
The shipped XML declares one String parameter, one String return and no optional arguments. Registration calls new Function("TOGGLE", func_toggle) and no alternate name or argument-count override is visible. English-language examples contain a single string argument, so no argument separator is needed. When combining with multi-argument functions, use the English handbook’s semicolon convention and account for localized formula separators.
The implementation converts its input to a QString and iterates the individual QChar elements. For each element it calculates lowercase and uppercase variants: it changes a character that compares equal to its lowercase form to uppercase; otherwise, if equal to its uppercase form, it changes it to lowercase. This is Qt per-code-unit logic. It is not proof of Unicode grapheme-by-grapheme processing or every locale-sensitive casing behaviour. The clearly demonstrated and independently reproduced examples here use ASCII letters, numbers and punctuation.
Practical worksheet: convert case row by row
In A2:A7 enter the following exact text values. Enter =TOGGLE(A2) in B2 and fill B2 down through B7. Keep A cells as text. All B values below are expected source-derived results, not observed spreadsheet outputs.
| Row | A input | Formula in B | Expected B | Note |
|---|---|---|---|---|
| 2 | hello |
=TOGGLE(A2) |
HELLO |
All lowercase becomes uppercase |
| 3 | HELLO |
=TOGGLE(A3) |
hello |
All uppercase becomes lowercase |
| 4 | HeLlO |
=TOGGLE(A4) |
hElLo |
Mixed case reversed |
| 5 | Hello, KDE! |
=TOGGLE(A5) |
hELLO, kde! |
Punctuation retained |
| 6 | A1_b2 |
=TOGGLE(A6) |
a1_B2 |
Digits and underscore unchanged |
| 7 | 123!? |
=TOGGLE(A7) |
123!? |
No ASCII letters to change |
The fourth example exposes TOGGLE’s main practical distinction: it doesn’t simply lowercase everything (hello, kde!) or uppercase everything (HELLO, KDE!); instead it reverses each eligible character’s case.
Literal and nested formulas
| Formula | Expected result | Verification context |
|---|---|---|
=TOGGLE("hello") |
HELLO |
Shipped KDE example |
=TOGGLE("HELLO") |
hello |
Shipped KDE example |
=TOGGLE("HeLlO") |
hElLo |
Shipped KDE example |
=TOGGLE("Hello, KDE!") |
hELLO, kde! |
ASCII case-by-case reasoning |
=TOGGLE("aBC Def") |
Abc dEF |
Each ASCII letter flips |
=TOGGLE("A1_b2") |
a1_B2 |
Nonletters unchanged |
=TOGGLE("123!? ") |
123!? |
Trailing space retained |
=TOGGLE(TOGGLE("AbC")) |
AbC |
Two passes restore basic ASCII letters |
=TOGGLE(UPPER("safety")) |
safety |
Uppercase then inversion; ASCII-only assumption |
Independent check: the expected outputs were computed independently by applying ASCII case reversal, then compared to the C++ algorithm and the three official KDE examples. Tests of non-ASCII letter expansion, malformed surrogate input and installed locales were not run.
Advanced usage and composition
Compare original and inverted labels
Put a label in A2 and use =CONCATENATE(A2;" -> ";TOGGLE(A2)) in B2. If A2 contains KDE Tools, the expected B2 is KDE Tools -> kde tOOLS. This is helpful in demonstrations of string transformations, not generally as a standardized naming system. CONCATENATE is independently registered and documented in KDE help.
Invert case then search or compare
With A2 as a text field, =EXACT(A2;TOGGLE(TOGGLE(A2))) is expected to return TRUE for ordinary ASCII text because two toggles restore the original casing. Use this only as a controlled example. Unicode character transforms and exotic scripts may not be perfectly involutive across all environments. The KDE EXACT reference documents exact text comparison.
Use the correct case function
For A2 containing mIxEd, =UPPER(A2) is expected to give MIXED, =LOWER(A2) to give mixed, and =TOGGLE(A2) to give MiXeD. PROPER is a different title-casing operation with additional word-boundary concerns. TOGGLE does not promise proper names or headlines. The three canonical functions have separate registrations, so they are distinct functions.
Make a reversible demonstration (ASCII only)
For exported or pasted Latin-only text, applying =TOGGLE(TOGGLE(A2)) is mathematically expected to restore the input when each involved character maps to a one-character opposite-case letter under the pinned Qt operations. Do not generalize that property to all Unicode characters, grapheme sequences or locale-specific mappings without native tests.
Errors, limits and troubleshooting
- Everything becomes uppercase or lowercase: that can be the correct inverse of an all-lowercase or all-uppercase input. If consistent capitalization is your goal, use UPPER or LOWER instead.
- Digits and punctuation do not change: TOGGLE only uses case-transform logic; basic digits, spaces and punctuation have no meaningful opposite letter case.
- Some international characters behave unexpectedly: the source loops through
QCharelements rather than full grapheme clusters. Qt’s Unicode case tables and any case-expanding mappings may lead to differences; test your target text and version natively before claiming exact Unicode support. - A numeric cell gives surprising text: the implementation requests a string conversion before case handling. The exact numeric rendering is potentially locale-dependent. Enter literal text for reproducible demonstrations and use
TEXTif explicit string conversion is part of your workflow. - A blank result or formula error appears: a truly empty string naturally stays empty. Formula-engine errors can propagate before this function body is reached; no exact displayed error codes have been observed. Inspect upstream formulas and data types before drawing conclusions.
- Case comparisons unexpectedly fail: look for invisible spaces, Unicode normalization and non-ASCII case folds; TOGGLE is not a universal case-insensitive comparer.
No numeric default, optional arguments, or application-specific text-length limit for TOGGLE appears in its shipped XML. Qt representation limits and native runtime error messages are outside what was tested here.
Compatibility: Excel and LibreOffice
In the checked official KDE catalogue, TOGGLE(text) is a Calligra-specific named function. Do not assume Excel or LibreOffice Calc has a built-in worksheet TOGGLE with equivalent syntax or identical Unicode behaviour. For simple ASCII English letters, a non-equivalent workaround may require combining UPPER, LOWER and per-character logic. We do not present an unvalidated universal replacement formula. The individual UPPER and LOWER operations are common concepts across spreadsheet applications, but this is not proof of TOGGLE portability.
When sharing sheets with Excel/LibreOffice users, check function translation/import results and preserve the original data. A formula may be renamed, lost, or evaluated differently depending on the importer and version; verify in the recipient application.
Official sources and related references
- KDE stable KF6 TOGGLE handbook — purpose, syntax and three documented examples; accessed 2026-10-12.
- KDE 26.08.2 text XML — exact one-text-argument definition and related functions; accessed 2026-10-12.
- KDE TOGGLE function registration — separate named function, no registered alias in the catalog; accessed 2026-10-12.
- Version-pinned TOGGLE implementation — Qt
QChariteration and simple case-change branches; accessed 2026-10-12. - KDE Gear 26.08.2 announcement — 2026-10-08 release; accessed 2026-10-12.
Related verified official sections: UPPER, LOWER, PROPER, EXACT, CONCATENATE.
Validation: Official documentation, immutable source and independent example reasoning were checked. No native Calligra execution, platform/locale tests or workbook interchange tests were performed.