Contact

SWITCH in Collabora Office: Map a Value to Its First Matching Result

Logical Intermediate Collabora Office Calc

Use Collabora SWITCH for exact-value mappings, a documented default and first-match priority.

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

Quick answer: =SWITCH(2;1;"January";2;"February";3;"March";"No match") has independently expected result “February”. SWITCH compares one expression with successive candidate values.

Syntax and parameter limits

=SWITCH(expression; value1; result1 [; value2; result2 ...] [; default_result])

Expression is the input to compare. Each candidate value has a paired result. The result from the first equal candidate is returned. The optional final default is used when no candidate matches.

The dedicated Collabora help permits up to 127 value/result pairs without a default, or 126 pairs when a default is included. Its expression may be text, numeric, logical, a date input or a reference. This guide uses clearly typed, ordinary values rather than relying on undocumented cross-type coercion.

SWITCH’s matching question is equality to the candidate value. It is not automatically a threshold or wildcard lookup. Use a condition-based construction when the intended rule compares ranges rather than specific codes.

Example 1: reproduce the documented month mapping

Put =DATE(2026;1;15), =DATE(2026;2;15), =DATE(2026;3;15) and =DATE(2026;4;15) in A3:A6. Enter =SWITCH(MONTH(A3);1;"January";2;"February";3;"March";"No match") in B3 and fill down.

Independent labels are January, February, March and No match. This reproduces the structure of the official example while supplying a complete dataset and an explicit fallback.

The date is converted to its month number by MONTH before SWITCH compares it. Directly comparing a complete date serial with the number two would not mean “a date in February.”

Example 2: detect duplicate candidate codes

=SWITCH(2;2;"First label";2;"Second label";"Unknown") has independent target First label. A duplicate later candidate does not override an earlier match.

When extending a long mapping, check for duplicate candidate values before appending another pair. A result can remain unchanged because an earlier match hides the new pair, even though both results are individually well-formed.

A compact mapping is easy to read inline. For a large frequently edited mapping, a separately maintained lookup table may be easier to audit; that is a workbook-design choice, not a different meaning of SWITCH.

Advanced application: return numeric weights

Put numeric codes 1, 2, 3 and 9 in D2:D5. Use =SWITCH(D2;1;10;2;20;3;30;0) in E2 and fill down. Independent outputs are 10, 20, 30 and 0, totaling 60.

The fallback zero is deliberate here. In another application an unmatched code may need a visible warning rather than an apparently valid zero. Choose the default based on what an unknown input actually means.

Keep the original code column rather than overwriting it with its mapped result. Otherwise a fallback can hide which unmapped input caused it.

Advanced application: keep text mappings typed

For text codes “A”, “B” and “Z”, the formula =SWITCH(D8;"A";"Alpha";"B";"Beta";"Unknown") has independent targets Alpha, Beta and Unknown when filled over those exact inputs.

These controls do not establish case sensitivity, whitespace trimming, regular-expression matching or equivalence between numeric 2 and text “2”. Normalize data only according to an explicit policy before applying a mapping that requires it.

Errors and troubleshooting

The cited help documents #N/A when no candidate matches and no default is supplied. Every candidate must have its paired result. Use semicolons in the English Calc formulas here even though the help’s displayed example uses comma-style separators.

SWITCH does not collect every match. It returns one result under a first-match rule. The documentation does not establish all unused-expression evaluation behavior, so these examples do not rely on a dangerous calculation being skipped merely because its branch is unselected.

Check the expression’s actual type and units before changing candidate values to make a formula match. A successful fallback is not proof that the original input was valid.

Availability and verification

The exact function is documented in Collabora Office 26.04 desktop help. This function’s cited help snapshot was retrieved on 2026-10-15 and hash-verified on October 15, 2026. Desktop documentation does not establish Online or mobile support. First introduction and last functioning release are unknown in this evidence.

No native Collabora Office execution occurred. Worked results are independent logical, calendar, structural or mathematical expectations. Formulas use English names and semicolon argument separators.

The help identifies namespace COM.MICROSOFT.SWITCH, outside its cited OpenFormula 1.3 standard. That format disclosure does not guarantee identical behavior in other software.

References