Excel has some very effective ways to fix errors on spreadsheets. The REPLACE function in Excel can replace text with new ones. It replaces characters with given location from a string with new text. In this tutorial, we will learn how the REPLACE function works in Excel.
Figure 1. Example of How to Use the Replace Function
=REPLACE (current_text, start_number, number_chars, new_text)
The REPLACE function uses four arguments. All of them are required for the function to work.
- current_text – It is the text which we want to replace
- start_number – It represents the position of the first character of the text we want to change.
- number_chars – The number or characters we want to replace.
- new_text – This is the text we want to replace the previous one with.
The REPLACE function alters a text with another one. We can replace the old text with a new one. All we need to do is input the arguments in the function. There are some important things to look out while working with this function. We need to provide the number of characters in the formula which need to be in a numeric form. Otherwise, it will show #VALUE! Error.
Setting up Data
The following example uses a student information database. Column A, B and C has the name, id and ages.
Figure 2. The Sample Data Set
In order to change the id handles using the REPLACE function, we need to
- Select cell D2 with the mouse.
- Write the function
=REPLACE(B2,3,5,"DF")in the formula bar of D2.
- Press Enter.
Figure 3. Applying the Formula
- Select and drag the function from cells D2 to D6.
This will change show the new ids in column D.
Most of the time, the problem you will need to solve will be more complex than a simple application of a formula or function. If you want to save hours of research and frustration, try our live Excelchat service! Our Excel Experts are available 24/7 to answer any Excel question you may have. We guarantee a connection within 30 seconds and a customized solution within 20 minutes.