REPLACE function is used to replace a specified part of a string. An array can also be used which can include DATE, TEXT or NUMERIC values, and the replacement string must be of the same type.


Syntax


REPLACE(x,y,z)


Parameters


x = The string, can also be an array of dates/numbers.


y = The substring the user wishes to have replaced. If using an array of dates/numbers for the string, the substring must be of the same type.


= The replacement string. If multiple instances of the substring are found the in search, all will be replaced by the replacement string. The replacement string is not required to be the same type as the substring.


Data Type Returned


REPLACE function returns text.


Examples


REPLACE(“SharpCloud”, “S”, “My S”) will return My SharpCloud.


REPLACE (“SharpCloud”, “harp”, “HARP”) will return SHARPCloud


REPLACE(“SharpCloud”, “C”, “”) will return Sharploud


REPLACE(REPLACE(“SharpCloud”, “Cloud”, “Water”), “Sharp”, “Smart”) will return SmartWater.


REPLACE([‘A’, ‘B’, ‘C’], ‘B’, ‘D) will return [‘A’, ‘D’, ‘C’]


REPLACE([1,1,2,3,4,5,6,7], 1, 0) will return [0,0,2,3,4,5,6,7]