Advertisements

Excel REPLACE Function

The Excel REPLACE Function replaces part of a text string with a different text string, and the function works based on the position and number of characters of the text.

Examples

Advertisements
  1. How to replace the first word in excel.
  2. How to replace the second character of the first word.
  3. How to replace the third word in excel.
  4. How to replace hyphen of the phone number with space in excel.
  5. How to replace text by variable position.
  6. How to generate numbers after special characters.
  7. How to replace the first two characters with space.
  8. How to replace numeric values in excel.
  9. How to replace dates in excel.
  10. How to insert hyphen (-) between numbers.
  11. How to replace multiple text with REPLACE. [Nested REPLACE]

Excel Replace Function, How to replace text in excel, How to substitute text in excel, replace second text in excel.

The Excel function REPLACEB performs the same job based on the number of bytes users specify. This function is intended for use with languages (e.g., Chinese, Korean, Japanese) that use double-byte character set.

Syntax

REPLACE(old_text, start_num, num_chars, new_text)

where,

wikitekkee note:

  1. Space is also counted as a character; therefore, users MUST count the space while calculating the text position.
  2. The Excel REPLACE function can be user with FIND function.

Example 1: Replace the first word:

Question: We want to change the first word, “to” with a new word “To”.

Answer: The formula is =REPLACE(B4, 1, 2, “To”), which replace the word “to” with new word “To”.

Excel replace Function, how to change text in excel, change the first word in excel.

Example 2: Replace the second character of the first word:

Question: How can I change the second character of the first word?

Advertisements

Answer: The formula is =REPLACE(B4, 2, 1, “o”), which replaced the word “TO” to “To” (changing the upper case of the letter “O” to lower case “o”.)

Excel Replace function. how to change second character of the first word in excel

Example 3: Replace the third word.

Question: How can I change the third word in my text?

Answer: The formula is =REPLACE(B5, 9, 4, “extra”), which replaced the third word “More” with “Extra“.

Excel REPLACE function, how to change the third word in excel, change text in excel.

Example 4: Replace hyphen (-) with space:

Question: How can I replace the hyphen (-) with space in excel?

Answer: The formula is =REPLACE(REPLACE(B5,4, 1, ” “), 8, 1, ” “), which replaced the hyphens (-) with space.

Excel replace function, replace hyphen, replace with space.

Example 5: Replace text by variable position.

Question: How can I replace text in variable position with special character?

Answer: The formula is =REPLACE(B5, 1, FIND(“:”, B5), ” “), which generates text after special character (:).

Excel REPLACE function, replace text by variable position.

Example 6: Generate numbers after special characters?

Question: How to generate numbers after special characters?

Advertisements

Answer: The formula is =REPLACE(B5, 1, FIND(“=”, B5), ” “), which generates numbers after equal (=) sign.

Excel REPLACE Function, generate number after special characters.

Example 7: Replace first two characters with space.

Question: How to replace the first two characters?

Answer: The formula is =REPLACE(B5, 1, 2, ” “), which replaced the first two characters with space.

Excel REPLACE Function, how to delete first two character in excel.

Example 8: Replace numeric values in Excel:

Question: How to replace numbers in excel?

Answer: The formula is =REPLACE(B5, 7, 4, 2022), which replaced 2016 by 2022.

Excel REPLACE Function, How to replace numbers in excel, replace numbers Excel function

Example 9: Replace dates in excel:

Question: How can I replace date format?

Answer: The formula is =REPLACE(TEXT(B5, “dd-mmm-yy”), 4, 3, “March”), which replaced the date format.

Excel REPLACE Function, How to replace dates in excel.

Example 10: Insert hyphen (-) between numbers:

Question: How to insert hyphen (-) between numbers.

Advertisements

Answer: The formula is =REPLACE(REPLACE(B5, 4, 0, “-“), 8, 0, “-“), which insert hyphens (-) between numbers.

Excel REPLACE Function, Insert hyphen in Excel, hyphen between numbers

Example 11: Replace multiple text with REPLACE:

Question: How to replace multiple text in excel.

Answer: The formula is =REPLACE(REPLACE(B5, 1, 5, “Neymar”), 16, 6, ” Brazil”), which replaced two words–Messi and France.

Replace multiple text in excel, Substitute multiple text in excel

More readings:

MS Excel official post

SUBSTITUE Function

2 Responses

  1. I like what you guys are up too. Such intelligent work and reporting! Keep up the excellent works guys I have incorporated you guys to my blogroll. I think it will improve the value of my web site 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Advertisements