Zoho Sheet SUBSTITUTE: Replace Matching Text Without Changing Cell Data
Clean recurring characters or words in imported IDs, with all-vs-one occurrence examples and troubleshooting.
Verification status: See the evidence and test scope described in this guide. How formula examples are checked
=SUBSTITUTE("CA_2026_0041";"_";"-") changes both underscores, producing CA-2026-0041. Zoho Sheet SUBSTITUTE matches text, and its optional fourth argument chooses one occurrence instead of all matches.
Availability and version history
- Introduced: The original introduction release and date are not established by the checked sources.
- Availability: Documented in Zoho Sheet’s current rolling web-service help; no final supported-version endpoint is established.
- Scope: English-language web documentation. Historical releases, mobile and offline-client parity remain separately unverified.
- Checked: October 14, 2026, against the official SUBSTITUTE entry. Explicit string and arithmetic examples were independently calculated; no native Zoho Sheet execution was performed.
Syntax and the case-sensitive matching rule
SUBSTITUTE(original_text; old_text; new_text; [which])
The first three arguments are required. Which is optional; the official entry states that all occurrences are replaced when it is omitted. Its explicit which=2 example identifies the second match. Zoho also states that matching is case-sensitive.
The occurrence number is not a character offset. REPLACE is the position-based operation. The replacement may change a string’s length, so do not assume that later fixed offsets remain correct after a substitution.
Enter all eight original order records
Create TextOrders, reserving A1:M12. Put Raw_ID, Customer, Stage and Note in A1:D1 and enter the complete original data below in A2:D9. All four columns contain text. The records are fictitious; no separate download is required.
| Row | A: Raw_ID | B: Customer | C: Stage | D: Note |
|---|---|---|---|---|
| 2 | CA_2026_0041 | East Depot | open | Priority: CA_2026_0041 |
| 3 | US_2026_0087 | West Market | closed | Archive: US_2026_0087 |
| 4 | CA_2025_0102 | North Hub | open | Priority: CA_2025_0102 |
| 5 | GB_2026_1042 | South Shop | hold | Review: GB_2026_1042 |
| 6 | CA_2026_0205 | East Depot | closed | Archive: CA_2026_0205 |
| 7 | US_2024_0130 | West Market | open | Review: US_2024_0130 |
| 8 | CA_2026_0420 | Central Store | hold | Priority: CA_2026_0420 |
| 9 | GB_2026_0011 | North Hub | closed | Archive: GB_2026_0011 |
Preserve the underscores and leading zeros. Put results in separate columns, beginning at F, rather than replacing any source field.
Compare every match with the first and second match
Put All underscores, First only, Second only, Prefix, CA-only change and Length in F1:K1. Enter these formulas in row 2 and fill F2:K2 through row 9:
F2: =SUBSTITUTE(A2;"_";"-")
G2: =SUBSTITUTE(A2;"_";"-";1)
H2: =SUBSTITUTE(A2;"_";"-";2)
I2: =LEFT(A2;2)
J2: =IF(I2="CA";F2;A2)
K2: =LEN(F2)
| Row | F | G | H | J: CA-only change |
|---|---|---|---|---|
| 2 | CA-2026-0041 | CA-2026_0041 | CA_2026-0041 | CA-2026-0041 |
| 3 | US-2026-0087 | US-2026_0087 | US_2026-0087 | US_2026_0087 |
| 4 | CA-2025-0102 | CA-2025_0102 | CA_2025-0102 | CA-2025-0102 |
| 5 | GB-2026-1042 | GB-2026_1042 | GB_2026-1042 | GB_2026_1042 |
| 6 | CA-2026-0205 | CA-2026_0205 | CA_2026-0205 | CA-2026-0205 |
| 7 | US-2024-0130 | US-2024_0130 | US_2024-0130 | US_2024_0130 |
| 8 | CA-2026-0420 | CA-2026_0420 | CA_2026-0420 | CA-2026-0420 |
| 9 | GB-2026-0011 | GB-2026_0011 | GB_2026-0011 | GB_2026_0011 |
I gives CA,US,CA,GB,CA,US,CA,GB; K is 12 throughout. J is the staged version of the original =IF(LEFT(A2;2)="CA";SUBSTITUTE(A2;"_";"-");A2) formula. LEFT checks the stated uppercase prefix convention, and IF decides whether to use the replacement. This does not authenticate an ID or validate the remaining fields.
Copy TextOrders as ChangedPrefix. Change only A3 to CA_2026_0087. I3 becomes CA and J3 becomes CA-2026-0087, while the original TextOrders row remains US_2026_0087. The transformation follows the current input.
Official examples and explicit case controls
On LiteralMatches, reserve A1:D10 and enter the formulas in B2:B7:
| Cell | Formula | Expected text |
|---|---|---|
| B2 | =SUBSTITUTE("Zoho Sheet";"o";"O";2) |
ZohO Sheet |
| B3 | =SUBSTITUTE("Spreadsheet";"sheet";"ing") |
Spreading |
| B4 | =SUBSTITUTE("Functions";"F";"J") |
Junctions |
| B5 | =SUBSTITUTE("CA_ca_CA";"CA";"US") |
US_ca_US |
| B6 | =SUBSTITUTE("CA_ca_CA";"ca";"us") |
CA_us_CA |
| B7 | =SUBSTITUTE("CA_ca_CA";"CA";"US";2) |
CA_ca_US |
The first three are Zoho’s direct examples. The lowercase middle fragment in B5 does not match uppercase CA. C2 =LEN(B2) filled through C7 gives 10,9,9,8,8,8. A visually similar uppercase/lowercase string can therefore have the same length while requiring a different matching rule.
Advanced: replacing one token can create a later match
Create ReplacementPipeline, reserving A1:F6. Put north-west, west-north and north-north in A2:A4. Enter B2:F2 and fill through row 4:
B2: =SUBSTITUTE(A2;"north";"west")
C2: =SUBSTITUTE(B2;"west";"east")
D2: =SUBSTITUTE(A2;"west";"east")
E2: =SUBSTITUTE(D2;"north";"west")
F2: =EXACT(C2;E2)
| Source | B | C | D | E | F |
|---|---|---|---|---|---|
| north-west | west-west | east-east | north-east | west-east | FALSE |
| west-north | west-west | east-east | east-north | east-west | FALSE |
| north-north | west-west | east-east | north-north | west-west | FALSE |
The first pipeline changes newly created west text too. The reverse pipeline leaves the later-created west untouched. EXACT makes the difference visible. The two formulas implement different policies even though they use the same two replacements.
Occurrence and import boundaries
The entry does not fully describe zero, negative, fractional or excessive which values, empty-search strings or overlapping matches. These are not guaranteed by a generic error table. Keep the positive occurrence examples separate from those boundaries and inspect imported punctuation before deciding a literal match has failed.
Formula entry and scope
Use Zoho’s documented semicolon separators, straight double quotes around literal text and a leading equals sign. Check the formula bar and stored cell types if an imported field does not reproduce the small sample. Formula results belong in separate cells; they do not repair the original field in place.
The shared help error table includes general name, reference and argument-type problems. It is not a complete native error matrix for this function. Unicode segmentation, every mixed-type conversion, exact error propagation and cross-client file imports remain outside these explicit ASCII examples.