How to replace the last or first character of the string in excel?

1 minute read

There are various use cases to remove the tail end character, like replacing the alias name, ex: 16 seconds or 16s to 16. It can be trimmed using the excel in-built function called “Replace”.

Replace function syntax:

REPLACE(old_text, start_num, num_chars, new_text)

Old_text   Required. Text in which you want to replace some characters.
Start_num  Required. The position of the character in old_text that you want to replace with new_text.
Num_chars  Required. The number of characters in old_text that you want REPLACE to replace with new_text.
New_text   Required. The text that will replace characters in old_text.
Fig 1. Syntax for the excel replace function

Excel formula to replace the last character:

=(REPLACE(B3, LEN(B3), LEN(B3), ""))
Fig 2. Formula to replace the last character of the string

Excel formula to replace the first character:

=(REPLACE(C3, 1, 1, ""))
Fig 3. Formula to replace the first character of the string

Leave a comment