REPLACEB in WPS Spreadsheet: Replace a Segment by Byte Position
Replace a whole-character segment in WPS’s documented Chinese/Latin byte context, separating removed length from replacement length.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
Quick answer: =REPLACEB("AB春风CD",3,4,"秋雨") is expected to return AB秋雨CD under the documented Chinese double-byte convention. The four-count segment 春风 is replaced by 秋雨.
Syntax and what the length controls
=REPLACEB(old_text,start_num,num_bytes,new_text)
All four arguments are required in the documented signature. Old_text is the source; start_num identifies the beginning of the removed segment; num_bytes is the length removed from the original; new_text is the replacement text.
The replacement is position-based, not a search-and-replace operation. It does not find every occurrence of a word. The count controls the removed segment and does not require the new text to have the same length.
Complete worksheet example
Enter text AB春风CD in A2. Its positions are A=1, B=2, 春=3–4, 风=5–6, C=7 and D=8. Enter =REPLACEB(A2,3,4,"秋雨") in B2.
The independent reconstruction is:
- Preserve the prefix AB before position 3.
- Remove four count units, namely 春风.
- Insert 秋雨.
- Preserve the remaining suffix CD.
The expected result is AB秋雨CD. The original cell A2 is still the input to the formula; the function returns a changed text value in the result cell.
Additional independent controls are:
| Formula | Expected text |
|---|---|
=REPLACEB("AB春风CD",3,4,"X") |
ABXCD |
=REPLACEB("AB春风CD",5,2,"雨") |
AB春雨CD |
=REPLACEB("AB春风CD",1,2,"Q") |
Q春风CD |
The first result is shorter because four count units were removed and one ASCII letter inserted. It demonstrates why the removal length should not be confused with the replacement text’s length.
Advanced use: standardize a controlled field
Suppose several records contain a two-character Chinese category after a two-letter ASCII prefix. Replacing start 3, length 4 can standardize that category while preserving the prefix and suffix. The same fixed positions are appropriate only while every record obeys that layout.
If some prefixes are longer or contain Chinese characters, the category starts elsewhere. A successful formula does not prove that the intended field was replaced. Inspect the original text, map its count positions and, when necessary, locate the target using a compatible position-finding method.
The official WPS walkthrough similarly replaces a three-Chinese-character label after an ASCII letter and digit, using start 3 and length 6. That historical example supports the mixed-width convention. The shorter original dataset above makes the removal and reconstruction independently visible.
Errors and unverified edge cases
The cited REPLACEB lesson does not supply a complete error table. This guide therefore does not assign a runtime error or a result to negative counts, zero counts, fractional arguments, starts beyond the text, overrun removal or half-character cuts.
In particular, do not assume that a past-the-end start appends text or that an excessive count is silently truncated. Those behaviors would need separate target-WPS evidence. The examples use valid positive positions, lengths inside the source and complete-character boundaries.
Use quoted text literals and keep the original column while reviewing replacements. Numeric-looking output remains a text transformation; the function does not validate numeric meaning, units or record identity.
Counting scope and safe boundaries
These examples use the historical lesson’s Chinese double-byte context: the ordinary Chinese characters shown count as 2, and Latin ASCII letters and digits count as 1. This is a spreadsheet counting convention for the documented context, not a universal UTF-8 byte-length rule. No result is inferred for emoji, supplementary characters, combining marks or every language/locale configuration.
All worked cuts land on complete-character boundaries. A position or length that cuts through one of the two-count Chinese characters is outside these examples; the lesson does not establish a reliable result for that case here. Do not invent a space, replacement character or partial encoded byte as the expected output.
Use the same counting system for positions and lengths. Character positions from a different function are not automatically compatible with byte-counted positions. Confirm the actual client and input convention before applying these formulas to an imported file.
Evidence and version scope
The official WPS Academy REPLACEB lesson, published 2020-04-09, explicitly applies to WPS Office for Windows Personal. It was reviewed on October 18, 2026. The numeric build, introduction release and last supported version remain unknown. The source does not identify this function as deprecated or retired. Support in Linux, other editions and other platforms is not established by this lesson.
The worked examples are original mathematical expectations based on the official contract and formula illustration. They were not executed in WPS. Historical vendor demonstrations are documentation, not our application tests; no screenshot or runtime precision guarantee is supplied. English names and comma separators follow the lesson. Localized entry, workbook interchange and exact output formatting require verification in the intended client.