REPLACE Function in ONLYOFFICE Spreadsheet Editor: Formula and Examples
Overwrite a fixed character span with replacement text.
Verification status: Official documentation referenced; example outcomes independently reasoned or arithmetically checked where stated. Not executed in ONLYOFFICE Spreadsheet Editor. How formula examples are checked
REPLACE function in ONLYOFFICE Spreadsheet Editor
Quick answer
REPLACE changes a set of characters specified by start position and count. With A6 = INV-2025-0412, =REPLACE(A6,5,4,"2026") is expected to return INV-2026-0412. REPLACE does not first look for the text 2025; it uses the fifth character and replaces four characters. See the current official REPLACE reference.
Purpose: when this formula is useful
This tutorial covers one canonical REPLACE function, not a separate page for localized names, byte-count variants or aliases. Use the formula when the goal is to produce a changed text value without editing the original source cell. Keep raw source values in column A and transformed results in another column. For exact matching against full codes or full rows, consider a lookup or validation workflow instead of mistaking a substring/position operation for a complete data-quality check.
Exact syntax and argument order
=REPLACE(old_text, start_num, num_chars, new_text)
| Argument | Required? | Exact role | Input example |
|---|---|---|---|
old_text |
Required | Original text or source cell reference. | A6 |
start_num |
Required | 1-based position of the first character to replace. | 5 |
num_chars |
Required | Number of original characters to remove starting at start_num. |
4 |
new_text |
Required | Text to insert at the selected position, which may be a different length. | "2026" |
Official interpretation: The ONLYOFFICE REPLACE/REPLACEB help page defines four required arguments for REPLACE. It describes replacement by the number of characters and starting position, not by looking up a word. The source also describes REPLACEB as a separate byte-oriented function for DBCS text, so do not collapse the byte and character variants into one canonical page.
Square brackets are documentation notation for optional parameters; do not type them into a real formula. The = sign is required for a formula in a sheet. The function name is English because these examples follow English ONLYOFFICE help.
Applicability, release evidence, and formula locale
The current English-language ONLYOFFICE Spreadsheet Editor function index and the linked function page document this function as part of ONLYOFFICE Docs Spreadsheet Editor. Both references were checked 2026-10-11 (UTC). The function help is not scoped to a numbered product build: first-supported version = UNKNOWN from this evidence. The index is not a promise that every historical Docs edition, Desktop Editors version, embedded editor or mobile app accepts the formula. No native edition/platform has been opened during this research run.
The Docs release history and the separate Desktop Editors history were consulted as version context, not as proof of a particular introduction version for this function. A Desktop release number must not be silently treated as the Docs server version. If supporting older releases, test the exact installed build and save the result before changing the wording.
For an English formula, use = plus the uppercase function name, parentheses, commas between arguments, and straight double quotes around literal strings, as illustrated in the official function-insertion guide. ONLYOFFICE lets the user choose a Formula Language and regional settings (official Advanced Settings); localized names or argument separators should be checked in the installed editor’s Function Arguments panel. Do not assume a delimiter or English spelling is universal in every locale. The examples below use English names, comma separators, 1-based character positions and plain ASCII strings; avoid date/numeric autocorrection by formatting source cells as text where appropriate.
Practice worksheet: use the same sample data for all four guides
Open a blank ONLYOFFICE workbook. In the first sheet, enter the exact raw text below into A1:A9. The examples treat these as text, not formula expressions. Keep all results in B or C so that the original values are preserved for auditing.
| Cell | Text to type (not a formula) | Why it is included |
|---|---|---|
| A1 | Source text |
Header only. |
| A2 | ORD-4821-ON |
Two hyphens, uppercase province code. |
| A3 | PO-1047-Toronto |
Case variation and a city label. |
| A4 | red-red-red |
Multiple literal matches. |
| A5 | INV|2026|0412 | Literal pipe separators (enter actual vertical bars in the cell). |
| A6 | INV-2025-0412 |
Fixed-position year field. |
| A7 | sales@Example.com |
Domain segment. |
| A8 | ABC-xyz-ABC |
Repeated uppercase substring. |
| A9 | PO-0008-WEST |
No Toronto substring. |
Important for A5: type the literal value INV|2026|0412 using normal vertical-bar characters. The | codes in the Markdown table only keep its columns aligned; do not type those codes into the spreadsheet. In A1 type Source text as a normal header. Do not copy backticks into the worksheet.
- Select a result cell outside column A; enter each formula shown below, starting with
=. - Press Enter; compare it to the expected result listed for the exact row. Expected results are calculations/logic checks, not observed output from ONLYOFFICE.
- If a result differs, check input capitalization, hidden spaces, typographic quotation marks, cell format and locale. Re-enter the formula using Formula → Function or the Function Arguments helper.
- Use Formula → Show Formulas to distinguish formulas from literal text and, if appropriate, recalculate using the Formula tab (both operations are described in the official editor instructions).
Reproducible worked examples and expected results
Use the input cells exactly as shown. Type each formula into the indicated output cell (B2:B7); leaving the originals in column A avoids accidental overwrites.
| Result cell | Formula to enter | Expected answer | Reason |
|---|---|---|---|
| B2 | =REPLACE(A6,5,4,"2026") |
INV-2026-0412 |
Year at 5–8 updated in the fixed-format invoice. |
| B3 | =REPLACE(A6,1,3,"ORD") |
ORD-2025-0412 |
Change a three-character prefix. |
| B4 | =REPLACE(A6,1,3,"SO") |
SO-2025-0412 |
Shorter replacement changes total length. |
| B5 | =REPLACE(A2,5,4,"9999") |
ORD-9999-ON |
Replace four-digit purchase order field. |
| B6 | =REPLACE(A7,1,5,"help") |
help@Example.com |
Text at the beginning of email changes; not domain validation. |
| B7 | =REPLACE(A9,4,4,"1050") |
PO-1050-WEST |
Fourth through seventh chars contain the four-digit code. |
How the position/occurrence reasoning was verified: these examples use literal ASCII text and independent character/substring operations. For an official expected error, such as #VALUE! on a no-match result, that classification comes from the directly cited ONLYOFFICE function documentation, not from executing the error in ONLYOFFICE. A result with a different case, extra space or character changes the test input and therefore requires a fresh expectation.
Advanced, practical workflows
Find the delimiter, then replace the following field
A6 (INV-2025-0412) happens to follow a fixed layout. For an expression that first identifies the first hyphen, use:
=REPLACE(A6,FIND("-",A6)+1,4,"2030")
Expected INV-2030-0412. The nested FIND reference returns 4 for the first hyphen, so REPLACE starts at 5 and removes 4 characters. This is independently checked for the exact ASCII row and not observed in the native app. It still assumes the desired field is four characters long and a hyphen exists.
Do not confuse rewriting with verification
A2 ORD-4821-ON and formula =REPLACE(A2,5,4,"0000") yield expected ORD-0000-ON. The appearance of a well-formed code does not prove the code is registered or unique; this is only text manipulation.
Edge cases, errors, and important limitations
- REPLACE is position-based, not substring-search-based; the old contents need not match a specified word or year. Use SUBSTITUTE for searching/replacing literal text.
- All four arguments are required in ONLYOFFICE’s official syntax. No start position or character-count default is described.
- Replacement text can be longer or shorter than the removed span; A6 with
SOillustrates a 3-to-2 character change. Do not assume preserved string length. - The ONLYOFFICE page uses a case-sensitive note even though this function does not compare a searched substring; position, not letter case, controls the selected span.
- Boundary inputs (
start_num0, negative positions, zero or negativenum_chars, positions after the end, Unicode graphemes) are PENDING_NATIVE_TEST; the inspected official page does not specify all corresponding return codes.
Unresolved behaviour: Error codes for invalid positions/counts and Unicode grapheme handling not specified in inspected unversioned ONLYOFFICE function page. Testing with simple ASCII strings is intentional: no assumption is made that byte-based variants, localized spellings, or Unicode indexing behave identically.
Troubleshooting checklist
| Symptom | How to diagnose it |
|---|---|
| Wrong substring changed | Count positions starting at 1; include hyphens and spaces in the index. |
| Changed too many/few characters | Check num_chars; it counts characters removed from old_text, not the size of new_text. |
| Output length changed | Expected when replacement length differs from num_chars. |
| Need to change a word wherever it appears | Use SUBSTITUTE; REPLACE does not locate a string by matching it. |
| Uncertain Unicode result | Retest the exact build/language and non-ASCII sample; the official description is not an edition-specific Unicode test. |
If the editor still disagrees with the expected ASCII outputs, first verify the current formula by selecting the result cell, then confirm each literal in A2:A9 matches the practice table. A copied formula may move references unintentionally; use anchored references only when you need them. Do not alter production data to make a tutorial example appear to pass.
Comparison with other spreadsheet programs
Microsoft Excel documents the same four required arguments for REPLACE. However, Excel’s help now includes an Excel Compatibility Version 2-specific Unicode surrogate-pair note. That must not be copied into an ONLYOFFICE compatibility claim without a corresponding ONLYOFFICE source or native test. See Microsoft REPLACE and ONLYOFFICE REPLACE.
The compatibility statement above is limited to documented function roles and English-language syntax. No Microsoft Excel, LibreOffice, Google Sheets, Apple Numbers or ONLYOFFICE comparison formula was actually run for this batch. Avoid claiming that the same error codes, Unicode positions, wildcard language, formula separators and byte-based variants are identical across products.
Related guides and site links
SUBSTITUTE for literal-text replacement; FIND/SEARCH to locate insertion positions; LEFT/MID for extraction. Owner-source-confirmed guide FILTER is a separate row-selection tool and should not be confused with replacing characters inside cells.
Only an existing source-confirmed URL is linked as a local site guide. Other named related functions are review-stage references, not claims that their pages are published or currently linked on the live website.
Official reference and verification
- ONLYOFFICE Spreadsheet Editor — function documentation
- ONLYOFFICE Spreadsheet Editor function index
- Docs release history
- Desktop Editors history
- official Advanced Settings
- FIND reference
Verification status: Official documentation checked; example outcomes were independently reasoned or arithmetically checked where applicable. Not executed in ONLYOFFICE Spreadsheet Editor.
- No genuine ONLYOFFICE Spreadsheet Editor screenshots are included; this guide does not use mock application images.