Excel SUBSTITUTE function: replace and clean up characters in text
Use SUBSTITUTE to strip dashes from phone numbers, remove “soum” and turn text into numbers, and count characters in a cell — with examples.
SUBSTITUTE replaces one piece of text with another: a dash with a space, “st.” with “street”, or an unwanted character with nothing — which simply deletes it.
It shines when you clean up exports from other systems: phone numbers from a CRM arrive as “+998 (90) 123-45-67”, prices copied from a website as “12 500 soum”. Fixing them by hand takes hours; SUBSTITUTE cleans the whole column with one formula.
Your source data stays untouched: the result appears in the next column, and if something is off you only fix the formula.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Phone | Clean number | ||
| 2 | 90-123-45-67 | 901234567 | ||
| 3 | 93-555-12-34 | 935551234 | ||
| 4 | 97-700-00-11 | 977000011 | ||
| 5 | 99-010-20-30 | 990102030 | ||
| 6 |
Syntax
=ПОДСТАВИТЬ(text; old_text; new_text; [instance_num])
- text — the original text or a cell (A2).
- old_text — what to replace, in quotes:
"-". - new_text — what to put instead. To delete, use empty quotes:
"". - instance_num — optional. Which occurrence to replace. If omitted, all occurrences are replaced.
The function is case-sensitive: “Tashkent” and “tashkent” are different strings to it.
Removing dashes from phone numbers
1
Select the result cell — B2.
2
On the Формулы tab click Текстовые and pick SUBSTITUTE from the list.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Phone | Clean number | ||
| 2 | 90-123-45-67 | |||
| 3 | 93-555-12-34 | |||
| 4 | ||||
| 5 |
3
In the arguments dialog enter Text A2, Old_text "-", New_text "". Leave Instance_num empty so every dash is removed. Click OK.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Phone | Clean number | ||
| 2 | 90-123-45-67 | 901234567 | ||
| 3 | 93-555-12-34 | |||
| 4 | ||||
| 5 |
4
Double-click the fill handle in the bottom-right corner of B2 — the formula is copied down the column. Experienced users just type it: =ПОДСТАВИТЬ(A2;"-";"").
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Phone | Clean number | ||
| 2 | 90-123-45-67 | 901234567 | ||
| 3 | 93-555-12-34 | 935551234 | ||
| 4 | 97-700-00-11 | 9770000111 | ||
| 5 |
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Phone (from CRM) | Digits only | ||
| 2 | +998 (90) 123-45-67 | +998901234567 | ||
| 3 | +998 (93) 555-12-34 | +998935551234 | ||
| 4 | +998 (97) 700-00-11 | +998977000011 | ||
| 5 |
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Contract | New format | ||
| 2 | CT-2025-0145 | CT-2025/0145 | ||
| 3 | CT-2025-0146 | CT-2025/0146 | ||
| 4 | CT-2024-0099 | CT-2024/0099 | ||
| 5 |
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Order | Items | ||
| 2 | bread, milk, yogurt | 3 | ||
| 3 | rice | 1 | ||
| 4 | apples, pears, grapes, pomegranate | 4 | ||
| 5 |
Pro level: turning a price stored as text into a number
“12 500 soum” copied from a website or Telegram is text to Excel, so it cannot be added up. Two SUBSTITUTEs plus VALUE fix it: first remove “ soum”, then the space, and finally convert the text into a number:
=ЗНАЧЕН(ПОДСТАВИТЬ(ПОДСТАВИТЬ(A2;" soum";"");" ";""))
Three more pro moves:
- Non-breaking space. Numbers from websites and accounting software often contain a “special” space (code 160). TRIM ignores it, SUBSTITUTE removes it:
=ПОДСТАВИТЬ(A2;CHAR(160);""). - Line breaks. Replace the Alt + Enter break inside a cell with a comma:
=ПОДСТАВИТЬ(A2;CHAR(10);", "). - SUBSTITUTE or REPLACE? SUBSTITUTE looks for what is written; REPLACE works by position:
=REPLACE(A2;1;4;"")deletes the first 4 characters, whatever they are.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Price (from site) | Number | ||
| 2 | 12 500 soum | 12 500 | ||
| 3 | 8 000 soum | 8 000 | ||
| 4 | 145 900 soum | 145 900 | ||
| 5 | Total | 166 400 | ||
| 6 |
Try it in the simulator
Column A has phone numbers with dashes. Type =ПОДСТАВИТЬ(A2;"-";"") in B2 and fill it down to B5. Then in C2 replace only the first dash with a space: =ПОДСТАВИТЬ(A2;"-";" ";1).
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Phone | Clean number | One space | |||||||||||||||||||||
| 2 | 90-123-45-67 | |||||||||||||||||||||||
| 3 | 93-555-12-34 | |||||||||||||||||||||||
| 4 | 97-700-00-11 | |||||||||||||||||||||||
| 5 | 99-010-20-30 | |||||||||||||||||||||||
| 6 | ||||||||||||||||||||||||
| 7 | ||||||||||||||||||||||||
| 8 | ||||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.