SUBSTITUTE Text
Part of the Formulas and Data Analysis section of Coddy's Excel journey. Lesson 22 of 28.
SUBSTITUTE(text, old_text, new_text) replaces every exact occurrence when the optional instance number is omitted. The match is case-sensitive. Use an empty string as new text to remove a character.
B2 contains AB-12-CD.
Example: =SUBSTITUTE(B2,"-","").
Both hyphens match and are replaced with empty text.
SUBSTITUTE replaces matching text, and omitted instance number means all occurrences.
The practice sheet highlights cells where you should enter formulas. The same formulas must work when the tests replace the input data.
Challenge
EasyCodes in B2:B4 contain hyphens. Remove all hyphens in C2:C4, preserving every other character.
Enter formulas in the highlighted output cells: C2, C3, C4. Keep the supplied data and headings. Tests change input values, so use cell references instead of typing the sample answers. Use English function names and commas between arguments.
Try it yourself
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Row | Raw code | Code | ||||
| 2 | 1 | AB-12 | |||||
| 3 | 2 | C-D-3 | |||||
| 4 | 3 | X99 | |||||
| 5 | |||||||
| 6 | |||||||
| 7 | |||||||
| 8 | |||||||
| 9 | |||||||
| 10 | |||||||
| 11 | |||||||
| 12 | |||||||
| 13 | |||||||
| 14 |
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Formulas and Data Analysis
5Cleaning Imported Data
TRIM SpacesSUBSTITUTE TextFinding a DelimiterConverting Numeric TextRecap: Imported LabelsPractice on your own: Excel playground