SWITCH Function (LibreOffice Calc)

Logical Beginner LibreOffice Calc

Learn the SWITCH function in LibreOffice Calc: Compares expression against list of value/result pairs, and returns result for first value that matches the.

The SWITCH function in LibreOffice Calc is used for this task: Compares expression against list of value/result pairs, and returns result for first value that matches the expression. If expression does not match any value, a default result is returned, if it is placed as final item in parameter list without a value. Select a result by comparing an input with possible matching cases.

This guide explains how to read the formula, reproduce a concrete example, interpret its result and recognize common input mistakes.

Syntax and arguments

SWITCH(expression; value; result)
Argument Required? Meaning
Expression Yes Value to be compared against value1…valueN (N ≤ 127)
Value Yes Value to compare against expression. If no result is given, then value is returned as default result.
Result Yes Value to return when corresponding value argument matches expression.

Calc formulas normally use semicolons (;) between arguments in common configurations; the displayed separator may depend on settings or locale.

Worked example

=SWITCH(2;1;"One";2;"Two";"Other")

Expected result: Two.

Why it works: Select a result by comparing an input with possible matching cases.

How to use it in your own spreadsheet

  1. Identify the cells or inputs that correspond to the sample values above.
  2. Enter the formula in an empty cell, changing the references or literal values to match your sheet.
  3. Compare the output with a manual check on a small known example.
  4. Extend the formula to a larger dataset only after you understand the result.

Common problems and practical checks

  • Be explicit about the difference between TRUE/FALSE, zero, blank cells and text values.
  • Consider how errors are handled instead of automatically suppressing them.
  • A pasted formula may produce an error when it uses the other program’s argument separator or unsupported options.

Documentation and verification

  • LibreOffice Calc Help
  • The standalone example was calculated using LibreOffice Calc 25.2.3.2 on October 9, 2026 and its computed result matched the expected value. This does not certify every option, version, or other example.