The syntax of the function is :
SUBSTITUTE( text, old_text, new_text, [instance_num] )
Where the function arguments are:
The Excel Substitute function is similar to the Excel Replace Function, but the Substitute function replaces one or more instances of a given text string, while the Replace function replaces text in a specified position of a supplied string.
Note also, that the Excel Substitute function is case sensitive. Therefore, if the old_text argument is the text string "A", this will NOT replace instances of the lower case text string "a".
Substitute Function Examples
The spreadsheets below show examples of use of the Excel Substitute Function. The spreadsheet on the left shows the format of the functions and the spreadsheet on the right shows the results.
Substitute Function Common Problem
Use of the Excel Substitute Function with Numbers, Dates and Times
The Excel Substitute function is designed for use with text strings and returns a text string.
Therefore, if you attempt to use the substitute function with a date, time or a number, it will give you unexpected results.
One solution to this problem is to convert the date, time or number into text, using the Excel Text To Columns tool:
No comments:
Post a Comment