Module 8 · Text
Fix the phone numbers

The last problem in the export: phone numbers. The software writes 201/555/0142, but the phone system needs 201-555-0142. And from June, the area code 201 changes to 551. Dana fixes all numbers with two formulas.
Steps
Replace a character with SUBSTITUTE
SUBSTITUTE replaces each copy of a text with a new text. You do not need to know where it is.
How to do it
- Select the cell for the result.
- Type =SUBSTITUTE( and the cell with the text. Type a comma.
- Type the old text and the new text in quotes. Type a closing bracket.
- Press Enter.
- To remove a character, replace it with an empty text: =SUBSTITUTE(C5,"/","").
=SUBSTITUTE(C5,"/","-")Task: Fix all phone numbers. Fill in D6:D12.
Replace characters at a position with REPLACE
REPLACE replaces characters at a position. You tell it where to start and how many characters to replace.
How to do it
- Click cell E5.
- Type =REPLACE( with the text, the start position and the number of characters.
- Type the new text in quotes and a closing bracket.
- Press Enter.
- SUBSTITUTE looks for a text. REPLACE uses a position. SUBSTITUTE(D5,"201","551") would also change 201 in the middle of a number.
=REPLACE(D5,1,3,"551")Task: Change the area code of all numbers. Fill in E6:E12.