Remove dashes
| A | |
|---|---|
| 1 | Phone |
| 2 | 555-123-4567 |
Formula: C1: =SUBSTITUTE(A2,"-","")
Result: 5551234567
An empty string as new_text deletes the old text.
Replaces text by its content.
SUBSTITUTE(text, old_text, new_text, [instance_num])Example: =SUBSTITUTE(A2,"-","")
Available in: All versions
SUBSTITUTE replaces specific text inside a string: =SUBSTITUTE(text, old_text, new_text, [instance_num]). It is the tool for removing dashes from phone numbers, swapping characters or replacing only the nth occurrence.
| A | |
|---|---|
| 1 | Phone |
| 2 | 555-123-4567 |
Formula: C1: =SUBSTITUTE(A2,"-","")
Result: 5551234567
An empty string as new_text deletes the old text.
| A | |
|---|---|
| 1 | List |
| 2 | a,b,c,d |
Formula: C1: =SUBSTITUTE(A2,",",";",2)
Result: a,b;c,d
The fourth argument 2 limits the change to the second comma.
| A | |
|---|---|
| 1 | Tags |
| 2 | red,green,blue |
Formula: C1: =LEN(A2)-LEN(SUBSTITUTE(A2,",",""))
Result: 2
Removing every comma shortens the text by the number of commas.
A tiny spreadsheet with example data. Edit the formula or any number and see the result.
Formula in D2: =SUBSTITUTE(A5,"-","/")
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Text | Other | Result | |
| 2 | Alice Johnson | alice johnson | SKU/2026/0415 | |
| 3 | alice@shop.com | ALICE@shop.com | ||
| 4 | extra spaces | |||
| 5 | SKU-2026-0415 | |||
| 6 | iced coffee, tea, sugar | |||
| 7 | Order 417 shipped |
Enter — commit · F2 — edit · F4 — $ in a reference · Ctrl+C/Ctrl+V — copy and paste · Ctrl+Z — undo
Esc or F6 — leave the sheet for the «Check» button · Shift+Tab in the first cell — back to the page