How can I use the SUBSTITUTE function in Excel with wildcards? 2

How can I use the SUBSTITUTE function in Excel with wildcards?

The SUBSTITUTE function in Excel allows users to replace specific text within a cell or range of cells with new text. By incorporating wildcards, such as asterisks or question marks, users can replace multiple instances of similar text at once. This can be useful when working with large amounts of data or when the exact text to be replaced may vary. The SUBSTITUTE function with wildcards is a powerful tool that can save time and effort in data management and manipulation tasks in Excel.

Excel: Use SUBSTITUTE Function with Wildcards


You can use the SUBSTITUTE function in Excel to substitute a specific substring in a cell with another substring.

Unfortunately, the SUBSTITUTE function doesn’t work with wildcard characters.

However, you can use the following formula to replace text in a cell using an approach that is similar to using wildcard characters:

=IFERROR(LEFT(A2,FIND("Mavs",A2)+LEN("Mavs"))&"are an awesome "&RIGHT(A2,LEN(A2)-FIND("team",A2)+LEN("team")-3), A2)

This particular formula uses a combination of the LEFT, RIGHT, FIND and LEN functions to replace all text in cell A1 between the strings “Mavs” and “team” with the text “are an awesome” instead.

The following example shows how to use this formula in practice.

Example: Substitute Text Using Wildcard Characters in Excel

Suppose we have the following list of phrases in Excel:

We can use the following formula to substitute all text in cell A2 between the strings “Mavs” and “team” with the text “are an awesome” instead.

=IFERROR(LEFT(A2,FIND("Mavs",A2)+LEN("Mavs"))&"are an awesome "&RIGHT(A2,LEN(A2)-FIND("team",A2)+LEN("team")-3), A2)

We’ll type this formula into cell B2 and then click and drag it down to each remaining cell in column B:

Excel SUBSTITUTE with wildcard characters

Notice that all text between the strings “Mavs” and “team” have been replaced with the text “are an awesome” instead.

Note that we used the IFERROR function to specify that if “Mavs” and “team” couldn’t be found then we should simply return the original phrase from column A.

Without the IFERROR function, the formula would return a #VALUE! error if the strings we searched for could not be found.

Cite this article

stats writer (2024). How can I use the SUBSTITUTE function in Excel with wildcards?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-the-substitute-function-in-excel-with-wildcards/

stats writer. "How can I use the SUBSTITUTE function in Excel with wildcards?." PSYCHOLOGICAL SCALES, 22 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-the-substitute-function-in-excel-with-wildcards/.

stats writer. "How can I use the SUBSTITUTE function in Excel with wildcards?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-the-substitute-function-in-excel-with-wildcards/.

stats writer (2024) 'How can I use the SUBSTITUTE function in Excel with wildcards?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-the-substitute-function-in-excel-with-wildcards/.

[1] stats writer, "How can I use the SUBSTITUTE function in Excel with wildcards?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I use the SUBSTITUTE function in Excel with wildcards?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top