Replace

Syntax

Replace(Old_text, Start_num, Num_chars, New_text)

Parameters

Old_text. Source string, in which you want to replace some characters.

Start_num. The position of the character in the source string, from which replacement should be started.

Num_chars. The number of characters in the source string that you want to replace.

New_text. Replacing string.

NOTE. To determine the parameter, specify either the parameter value or the cell address where it is located.

Description

It replaces part of a text string with a different text string.

Comments

Numbering of string characters starts with zero.

Example

Formula Result Description
=Replace("asdfgh", 1, 2, "12") a12fgh It replaces two characters starting from the first one in the asdfgh string with the 12 string.
=Replace(B6, 0, 5, C6) +56 It replaces five characters from the beginning of the string contained in the B6 cell with a string in the C6 cell. The B6 cell contains the 0123456 value, the C6 cell contains the value +.

See also:

Function WizardText FunctionsMidRept