Contact

SUBSTITUTE Function in Collabora Office Calc: Formula, Examples & Troubleshooting

Text Beginner Collabora Office Calc

Learn the SUBSTITUTE formula in Collabora Office Calc: replace occurrences of text with a new string, with reproducible examples, expected answers and compatibility cautions.

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

Quick answer: SUBSTITUTE replaces a selected text segment with new text. Omitting the optional occurrence replaces it throughout the source; supplying an occurrence selects that match. =SUBSTITUTE("A-101-A";"A";"B";2) gives expected A-101-B.

Availability and version history

  • Introduced: original Collabora release and launch date are not established by the sources reviewed.
  • Availability: documented in Collabora Office 26.04 help, scoped to the desktop-help release.
  • Platform scope: online and mobile deployments are not inferred from desktop documentation.
  • Checked: October 14, 2026. Direct function documentation and independently modeled text controls; no native Collabora test was performed.

Syntax and the optional occurrence

=SUBSTITUTE(text;old_text;new_text;[instance_num])

The first argument supplies the source. old_text is the segment to replace, new_text is its replacement, and the optional final argument selects which occurrence changes. Collabora’s direct examples confirm both all-occurrence and second-occurrence behavior.

English function names and semicolon separators are used. The bracket notation marks an optional argument; do not paste the brackets into the actual formula. The controls use explicit nonempty search segments and positive whole-number occurrences that exist in the source.

Example 1: retain the original single-occurrence control

=SUBSTITUTE("A-101-A";"A";"B";2)

Expected text: A-101-B. The initial A stays unchanged, while the second matching A is replaced. Occurrence two is not the second character position; it counts matching search segments.

The corresponding formula without the fourth argument gives B-101-B. Decide whether every occurrence should change before copying the formula across a real dataset.

Example 2: retain the original all-occurrence control

=SUBSTITUTE("2026/10/11";"/";"-")

Expected text: 2026-10-11. Both slashes are replaced because no occurrence is specified. This transforms the characters of a label; it does not prove the string is a valid date or establish the spreadsheet’s date parser.

The original source should remain available until any later parsing or external file export has been checked separately.

Advanced example: inspect each possible selected occurrence

For source A|B|C|D, try:

=SUBSTITUTE("A|B|C|D";"|";"/";1)
=SUBSTITUTE("A|B|C|D";"|";"/";2)
=SUBSTITUTE("A|B|C|D";"|";"/";3)

Expected results are A/B|C|D, A|B/C|D and A|B|C/D. Omitting the occurrence gives A/B/C/D. The four outputs make the selection rule visible without relying on a large nested expression.

These examples do not establish negative, zero, fractional or beyond-last occurrence behavior. Such inputs are outside the controlled cases and are not assigned guessed native errors.

Advanced example: count nonoverlapping delimiter occurrences

Put red|blue|green in H2. Then:

=LEN(H2)-LEN(SUBSTITUTE(H2;"|";""))

Expected result: 2. The source length is 14 and the delimiter-free result redbluegreen has length 12. This counts a one-character separator; the arithmetic changes for a longer search segment.

For source AA–BB–C in J2, =(LEN(J2)-LEN(SUBSTITUTE(J2;"--";"")))/2 has expected result 2, since the lengths are 9 and 5. The example uses nonoverlapping, exact two-character segments. It is not an established rule for every overlapping or empty-pattern case.

Advanced example: the order of replacements matters

Starting with A-B, replacing A with B and then B with C produces expected C-C:

=SUBSTITUTE(SUBSTITUTE("A-B";"A";"B");"B";"C")

Reversing those steps produces B-C. A nested cleanup pipeline acts on the output of its inner call, including newly introduced text. Retain helper columns when each step needs review.

Troubleshooting and boundaries

Use REPLACE for a known character position; SUBSTITUTE selects matching segments instead. The dedicated page does not give a complete case-matching, wildcard, regular-expression, empty-pattern or Unicode-normalization specification. Do not turn its short definition into a universal imported-pattern guarantee.

These controls deliberately use exact visibly identical search text and ordinary delimiters. Check representative target-file values before applying a wider cleanup policy. A transformed label can be syntactically tidy while still being semantically wrong.

References and verification

The complete older article and its original worked formulas were reviewed. This revision replaces an unrelated mathematical-category citation with the dedicated function page and adds independently modeled text controls. No native Collabora execution or complete cross-deployment certification is claimed.