Replace all words excel

Connect with an expert. Learn from live instructors.

Use the Find and Replace features in Excel to search for something in your workbook, such as a particular number or text string. You can either locate the search item for reference, or you can replace it with something else. You can include wildcard characters such as question marks, tildes, and asterisks, or numbers in your search terms. You can search by rows and columns, search within comments or values, and search within worksheets or entire workbooks.

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Find

To find something, press Ctrl+F, or go to Home > Editing > Find & Select > Find.

Note: In the following example, we’ve clicked the Options >> button to show the entire Find dialog. By default, it will display with Options hidden.

Press Ctrl+F to launch the Find dialog

  1. In the Find what: box, type the text or numbers you want to find, or click the arrow in the Find what: box, and then select a recent search item from the list.

    Tips: You can use wildcard characters — question mark (?), asterisk (*), tilde (~) — in your search criteria.

    • Use the question mark (?) to find any single character — for example, s?t finds «sat» and «set».

    • Use the asterisk (*) to find any number of characters — for example, s*d finds «sad» and «started».

    • Use the tilde (~) followed by ?, *, or ~ to find question marks, asterisks, or other tilde characters  — for example, fy91~? finds «fy91?».

  2. Click Find All or Find Next to run your search.

    Tip: When you click Find All, every occurrence of the criteria that you are searching for will be listed, and clicking a specific occurrence in the list will select its cell. You can sort the results of a Find All search by clicking a column heading.

  3. Click Options>> to further define your search if needed:

    • Within: To search for data in a worksheet or in an entire workbook, select Sheet or Workbook.

    • Search: You can choose to search either By Rows (default), or By Columns.

    • Look in: To search for data with specific details, in the box, click Formulas, Values, Notes, or Comments.

      Note:   Formulas, Values, Notes and Comments are only available on the Find tab; only Formulas are available on the Replace tab.

    • Match case — Check this if you want to search for case-sensitive data.

    • Match entire cell contents — Check this if you want to search for cells that contain just the characters that you typed in the Find what: box.

  4. If you want to search for text or numbers with specific formatting, click Format, and then make your selections in the Find Format dialog box.

    Tip: If you want to find cells that just match a specific format, you can delete any criteria in the Find what box, and then select a specific cell format as an example. Click the arrow next to Format, click Choose Format From Cell, and then click the cell that has the formatting that you want to search for.

Replace

To replace text or numbers, press Ctrl+H, or go to Home > Editing > Find & Select > Replace.

Note: In the following example, we’ve clicked the Options >> button to show the entire Find dialog. By default, it will display with Options hidden.

Press Ctrl+H to launch the Replace dialog.

  1. In the Find what: box, type the text or numbers you want to find, or click the arrow in the Find what: box, and then select a recent search item from the list.

    Tips: You can use wildcard characters — question mark (?), asterisk (*), tilde (~) — in your search criteria.

    • Use the question mark (?) to find any single character — for example, s?t finds «sat» and «set».

    • Use the asterisk (*) to find any number of characters — for example, s*d finds «sad» and «started».

    • Use the tilde (~) followed by ?, *, or ~ to find question marks, asterisks, or other tilde characters  — for example, fy91~? finds «fy91?».

  2. In the Replace with: box, enter the text or numbers you want to use to replace the search text.

  3. Click Replace All or Replace.

    Tip: When you click Replace All, every occurrence of the criteria that you are searching for will be replaced, while Replace will update one occurrence at a time.

  4. Click Options>> to further define your search if needed:

    • Within: To search for data in a worksheet or in an entire workbook, select Sheet or Workbook.

    • Search: You can choose to search either By Rows (default), or By Columns.

    • Look in: To search for data with specific details, in the box, click Formulas, Values, Notes, or Comments.

      Note:   Formulas, Values, Notes and Comments are only available on the Find tab; only Formulas are available on the Replace tab.

    • Match case — Check this if you want to search for case-sensitive data.

    • Match entire cell contents — Check this if you want to search for cells that contain just the characters that you typed in the Find what: box.

  5. If you want to search for text or numbers with specific formatting, click Format, and then make your selections in the Find Format dialog box.

    Tip: If you want to find cells that just match a specific format, you can delete any criteria in the Find what box, and then select a specific cell format as an example. Click the arrow next to Format, click Choose Format From Cell, and then click the cell that has the formatting that you want to search for.

There are two distinct methods for finding or replacing text or numbers on the Mac. The first is to use the Find & Replace dialog. The second is to use the Search bar in the ribbon.

Find & Replace dialog

Search bar and options

Find window

  1. Press Ctrl+F or go to Home > Find & Select > Find.

  2. In Find what: type the text or numbers you want to find.

  3. Select Find Next to run your search.

  4. You can further define your search:

    • Within: To search for data in a worksheet or in an entire workbook, select Sheet or Workbook.

    • Search: You can choose to search either By Rows (default), or By Columns.

    • Look in: To search for data with specific details, in the box, click Formulas, Values, Notes, or Comments.

    • Match case — Check this if you want to search for case-sensitive data.

    • Match entire cell contents — Check this if you want to search for cells that contain just the characters that you typed in the Find what: box.

Tips: You can use wildcard characters — question mark (?), asterisk (*), tilde (~) — in your search criteria.

  • Use the question mark (?) to find any single character — for example, s?t finds «sat» and «set».

  • Use the asterisk (*) to find any number of characters — for example, s*d finds «sad» and «started».

  • Use the tilde (~) followed by ?, *, or ~ to find question marks, asterisks, or other tilde characters  — for example, fy91~? finds «fy91?».

Find Options

  1. Press Ctrl+F or go to Home > Find & Select > Find.

  2. In Find what: type the text or numbers you want to find.

  3. Select Find All to run your search for all occurrences.

    Find all drop display

    Note:  The dialog box expands to show a list of all the cells that contain the search term, and the total number of cells in which it appears.

  4. Select any item in the list to highlight the corresponding cell in your worksheet.
     

    Note: You can edit the contents of the highlighted cell.

  1. Press Ctrl+H or go to Home > Find & Select > Replace.

  2. In Find what, type the text or numbers you want to find.

  3. You can further define your search:

    • Within: To search for data in a worksheet or in an entire workbook, select Sheet or Workbook.

    • Search: You can choose to search either By Rows (default), or By Columns.

    • Match case — Check this if you want to search for case-sensitive data.

    • Match entire cell contents — Check this if you want to search for cells that contain just the characters that you typed in the Find what: box.
       

      Tips: You can use wildcard characters — question mark (?), asterisk (*), tilde (~) — in your search criteria.

      • Use the question mark (?) to find any single character — for example, s?t finds «sat» and «set».

      • Use the asterisk (*) to find any number of characters — for example, s*d finds «sad» and «started».

      • Use the tilde (~) followed by ?, *, or ~ to find question marks, asterisks, or other tilde characters — for example, fy91~? finds «fy91?».

  4. In the Replace with box, enter the text or numbers you want to use to replace the search text.

  5. Select Replace or Replace All.

    Tips: 

    • When you select Replace All, every occurrence of the criteria that you are searching for is replaced.

    • When you select Replace, you can replace one instance at a time by selecting Next to highlight the next instance.

  1. Select any cell to search the entire sheet or select a specific range of cells to search.

  2. Press Command + F or select the magnifying glass to expand the Search bar and type the text or number you want to find in the search field.

    Tips: You can use wildcard characters — question mark (?), asterisk (*), tilde (~) — in your search criteria.

    • Use the question mark (?) to find any single character — for example, s?t finds «sat» and «set».

    • Use the asterisk (*) to find any number of characters — for example, s*d finds «sad» and «started».

    • Use the tilde (~) followed by ?, *, or ~ to find question marks, asterisks, or other tilde characters — for example, fy91~? finds «fy91?».

  3. Press return.

    Notes: 

    • To find the next instance of the item you are searching for, press return again or use the Find dialog box and select Find Next.

    • To specify additional search options, select the magnifying glass and select Search in Sheet or Search in Workbook. You can also select the Advanced option, which launches the Find dialog.

    Tip: You can cancel a search in progress by pressing ESC.

Find

To find something, press Ctrl+F, or go to Home > Editing > Find & Select > Find.

Note: In the following example, we’ve clicked > Search Options to show the entire Find dialog. By default, it will display with Search Options hidden.

Find text or numbers in a workbook or worksheet by pressing Ctrl+F

  1. In the Find what: box, type the text or numbers you want to find.

    Tips: You can use wildcard characters — question mark (?), asterisk (*), tilde (~) — in your search criteria.

    • Use the question mark (?) to find any single character — for example, s?t finds «sat» and «set».

    • Use the asterisk (*) to find any number of characters — for example, s*d finds «sad» and «started».

    • Use the tilde (~) followed by ?, *, or ~ to find question marks, asterisks, or other tilde characters  — for example, fy91~? finds «fy91?».

  2. Click Find Next or Find All to run your search.

    Tip: When you click Find All, every occurrence of the criteria that you are searching for will be listed, and clicking a specific occurrence in the list will select its cell. You can sort the results of a Find All search by clicking a column heading.

  3. Click > Search Options to further define your search if needed:

    • Within: To search for data within a certain selection, choose Selection. To search for data in a worksheet or in an entire workbook, select Sheet or Workbook.

    • Direction: You can choose to search either Down (default), or Up.

    • Match case — Check this if you want to search for case-sensitive data.

    • Match entire cell contents — Check this if you want to search for cells that contain just the characters that you typed in the Find what box.

Replace

To replace text or numbers, press Ctrl+H, or go to Home > Editing > Find & Select > Replace.

Note: In the following example, we’ve clicked > Search Options to show the entire Find dialog. By default, it will display with Search Options hidden.

Replace text or numbers in a workbook or worksheet by pressing Ctrl+H

  1. In the Find what: box, type the text or numbers you want to find.

    Tips: You can use wildcard characters — question mark (?), asterisk (*), tilde (~) — in your search criteria.

    • Use the question mark (?) to find any single character — for example, s?t finds «sat» and «set».

    • Use the asterisk (*) to find any number of characters — for example, s*d finds «sad» and «started».

    • Use the tilde (~) followed by ?, *, or ~ to find question marks, asterisks, or other tilde characters  — for example, fy91~? finds «fy91?».

  2. In the Replace with: box, enter the text or numbers you want to use to replace the search text.

  3. Click Replace or Replace All.

    Tip: When you click Replace All, every occurrence of the criteria that you are searching for will be replaced, while Replace will update one occurrence at a time.

  4. Click > Search Options to further define your search if needed:

    • Within: To search for data within a certain selection, choose Selection. To search for data in a worksheet or in an entire workbook, select Sheet or Workbook.

    • Direction: You can choose to search either Down (default), or Up.

    • Match case — Check this if you want to search for case-sensitive data.

    • Match entire cell contents — Check this if you want to search for cells that contain just the characters that you typed in the Find what box.

Need more help?

You can always ask an expert in the Excel Tech Community or get support in the Answers community.

Recommended articles

Merge and unmerge cells

REPLACE, REPLACEB functions

Apply data validation to cells

Skip to content

How to Replace Text in Excel with the REPLACE function (2023)

How to Replace Text in Excel with the REPLACE function (2023)

Need to replace text in multiple cells?

Excel’s REPLACE and SUBSTITUTE functions make the process much easier.

Let’s take a look at how the two functions work, how they differ, and how you put them to use in a real spreadsheet🔍

If you want to follow along with what I show you, download my workbook here.

Replacing characters in text with the REPLACE function

The REPLACE function substitutes a text string with another text string.

Let’s say your boss tells you that the product IDs for a product line must be changed.

But only a part of the product ID should be changed – not all of it.

Here, the “29FA” part of all the product IDs needs to be changed to “39LU”.

To do that with the REPLACE function, we’ll walk through the syntax of the REPLACE function, which goes like this:

=REPLACE(old_text, start_num, num_chars, new_text)

Don’t worry, it’s not as daunting as it looks. It’s actually pretty straightforward👍

Step 1: Old text

The old text argument is a reference to the cell where you want to replace some text. Write:

=REPLACE(A2

Excel replace function - reference to old text argument of syntax

And put a comma to wrap up the first argument, and let’s move on to the next.

Step 2: Start num

The start_num argument determines where the REPLACE function should start replacing characters from.

In our case, the “29FA” part starts on the 3rd character in the text.

Excel replace function to replace text from a specified position

So, write:

=REPLACE(A2, 3,

Now, we’ve established where the REPLACE function should start to replace text.

Still with me? Then let’s dive into the next argument of the REPLACE syntax🤿

Step 3: Num chars

Also called the “number of characters” argument, this determines how many characters should be replaced with the new text.

Typically, this should be the length of the text you want to replace the old text with.

So, it ties together with the next argument.

If you want to replace “29FA” with “39LU”, then you’re replacing the next 4 characters.

Write:

=REPLACE(A2, 3, 4

Excel replace function - number of characters to replace

And wrap it up with a comma🎁

There are situations where this num_chars argument should be a different length than the new_text argument. I’ll tell you more about that later.

Kasper Langmann, Microsoft Office Specialist

Step 4: New text

The new_text argument is the replacement text for the old text.

So, simply write the new characters that should replace the old 4 characters:

=REPLACE(A2, 3, 4, “39LU”

Excel replace function - new text argument

Remember the double quotes when the replacement text is letters or a combination of numbers and letters.

Wrap up the formula with an end parenthesis and press Enter.

Now, the “29FA” part of the old product ID is replaced with “39LU”.

Excel replace function - visual example

PRO TIP: Length of num_chars vs new_text

If you need the replacement text to be shorter or longer than the text it’s replacing, you can have a different length in the 3rd and 4th argument of REPLACE. Let me give you a few formula examples of that:

If you wanted to replace the “29FA” with “39L” instead, you’d write:

=REPLACE(A2, 3, 4, “39L”)

But the length of the 4th argument would be shorter than the 4 characters defined in the 3rd argument.

On the other hand, if you wanted to replace “FA” with “LLUU”, you’d write this:

=REPLACE(A2, 5, 2, “LLUU”)

Formula example Different length in number of characters and new text

Replacing text strings with the SUBSTITUTE function

If the string you want to replace doesn’t always appear in the same place, you’re better off using the SUBSTITUTE function.

The syntax of SUBSTITUTE goes like this:

=SUBSTITUTE(text, old_text, new_text, [instance_num])

This is a little different from the last syntax of the REPLACE function, so be careful not to get them mixed up⚠️

Step 1: Text

The text argument is just a cell reference to the cell where you want to replace text.

Write:

=SUBSTITUTE(A2

Excel substitute function to replace text - text argument

And of course, put a comma to go to the next argument.

Step 2: Old text

The SUBSTITUTE function doesn’t replace characters from a fixed position in a cell.

Instead, it cleverly searches for a text string and begins replacing characters from there🔍

So, if you want to replace the “FA” part of the product ID with “LU”, write:

=SUBSTITUTE(A2, “FU”

Excel substitute function - old text argument

Step 3: New text

The new_text argument is what the old text should be replaced with.

For this example, that’s “LU”.

=SUBSTITUTE(A2, “FA”, “LU”

Excel replace text - old text and new text

The new text doesn’t have to be the same length as the old text.

Kasper Langmann, Microsoft Office Specialist

Step 4: Instance num

The optional instance num argument decides how many times the text should be replaced.

This is relevant if there is more than one instance of the old text.

The instance_num argument is optional. If you leave it blank, every instance of the old text is replaced by the new text😊

In the following formula example, the first 2 product IDs each have 2 instances of the “FA”. So, the instance num argument determines whether only the first instance of “FA” is replaced with “LU” or both instances of “FA” is replaced with “LU”.

As you can see from the picture below, write 1 if you want only the first instance of “FA” to be replaced.

=SUBSTITUTE(A2, “FA”, “LU”, 1)

Or don’t use the instance num argument if every instance of “FA” should be replaced:

=SUBSTITUTE(A2, “FA”, “LU”)

Excel substitute formula examples with instance number argument for multiple replacements

And that’s how to replace text dynamically based on the location of the text you want to replace.

The difference between REPLACE and SUBSTITUTE

There are a few subtle differences between these two “replace functions”.

Both of them replace one or more characters in a text string with another text string.

The difference lies in how the first string is identified.

REPLACE selects the first string based on the position. So you might replace four characters, starting with the sixth character in the string.

SUBSTITUTE selects based on whether the string matches a predefined search. You might tell Excel to replace any instance of “FA” with “LU” for example.

Other than that, the two functions are identical👬🏻

Replace text using Find and Replace

Another way to replace text is with the ‘Find and Replace’ feature of Excel.

It’s a way to substitute characters in the original cell instead of having to add additional columns with formulas.

1. Select all the cells that contain the text to replace.

2. From the ‘Home’ tab, click ‘ Find and Select’.

Find and Select Excel feature

3. From the Find and Replace dialog box (in the replace tab) write the text you want to replace, in the ‘Find what:’ field.

4. Still within the ‘Find and Replace’ dialog box, write the new text to replace the old text with in the ‘Replace with:’ field.

Replace text by using the find what and replace with fields from Find and Replace dialog box

5. When you click the ‘Replace all’ button, Excel replaces all instances of the old text with the new text, in the selected cells.

If you instead want to replace all instances of the text within the entire workbook, just select a single cell before opening the ‘Find and Replace’ dialog box.

(Instead of selecting multiple cells).

Kasper Langmann, Microsoft Office Specialist

That’s it – Now what?

With the REPLACE and SUBSTITUTE functions, you can replace very specific strings with other strings. You can use letters, numbers, or other characters.

In short, you can replace text with extreme accuracy. And that saves you a great deal of time when you need to make a lot of edits.

Additionally, you can use the Find and Replace tool, which is the most underrated feature of Excel.

But no one got a job offer just based on their skills to replace characters in a text in Microsoft Excel.

Luckily, there are other areas of Excel that are magnets for job offers🧲

Click here to learn IF, SUMIF, VLOOKUP, and pivot tables (yup, that’s the magnets) for FREE in my 30-minute online Excel course.

Other resources

Replacing text is often used to clean up data so it’s ready for analysis, formulas, pivot tables, etc.

Other ways of cleaning up data are with other important Excel functions like LEFT, RIGHT, MID, and LEN.

Or with one of the two ways of deleting blank rows (one better than the other). Read all about it here.

Kasper Langmann2023-01-19T12:24:59+00:00

Page load link

Purpose 

Replace text based on content

Usage notes 

The Excel SUBSTITUTE function can replace text by matching. Use the SUBSTITUTE function when you want to replace text based on matching, not position. Optionally, you can specify the instance of found text to replace (i.e. first instance, second instance, etc.).

SUBSTITUTE is case-sensitive. To replace one or more characters with nothing, enter an empty string («»).

Examples

Below are the formulas used in the example shown above:

=SUBSTITUTE(B5,"t","b") // replace all t's with b's
=SUBSTITUTE(B6,"t","b",1) // replace first t with b
=SUBSTITUTE(B7,"cat","dog") // replace cat with dog
=SUBSTITUTE(B8,"&","") // replace # with nothing
=SUBSTITUTE(B9,"-",", ") // replace hyphen with comma

The SUBSTITUTE function cannot replace more than one string at a time. However, SUBSTITUTE can be nested inside of itself to accomplish the same thing. For example, with the text «a (dog)» in cell A1, the formula below will strip parentheses () from text:

=SUBSTITUTE(SUBSTITUTE(A1,"(",""),")","") // returns "a dog"

This same approach can be used in a more complex formula to normalize telephone numbers.

Related functions

Use the REPLACE function to replace text at a known location in a text string. Use the SUBSTITUTE function to replace text by searching when the location is not known. Use FIND or SEARCH to determine the location of specific text.

Notes

  • SUBSTITUTE finds and replaces old_text with new_text in a text string.
  • Instance limits SUBSTITUTE replacement a particular instance of old_text.
  • When instance is omitted, all instances of old_text are replaced with new_text.
  • SUBSTITUTE is case-sensitive and does not support wildcards.

Содержание

  1. REPLACE, REPLACEB functions
  2. Description
  3. Syntax
  4. Example
  5. REPLACE Function
  6. Related functions
  7. Summary
  8. Purpose
  9. Return value
  10. Arguments
  11. Syntax
  12. Usage notes
  13. Examples
  14. Related functions
  15. Find or replace text and numbers on a worksheet
  16. Replace
  17. Excel Replace Function
  18. Function Description
  19. Replace Function Examples
  20. Replace Function Error
  21. Common Problem — Use of the Excel Replace Function with Numbers, Dates and Times
  22. Examples of working with text function REPLACE in Excel
  23. How does the REPLACE function in Excel work?
  24. REPLACE function in Excel and examples of its use
  25. How to REPLACE a piece of text in Excel cell?

REPLACE, REPLACEB functions

This article describes the formula syntax and usage of the REPLACE and REPLACEB function in Microsoft Excel.

Description

REPLACE replaces part of a text string, based on the number of characters you specify, with a different text string.

REPLACEB replaces part of a text string, based on the number of bytes you specify, with a different text string.

These functions may not be available in all languages.

REPLACE is intended for use with languages that use the single-byte character set (SBCS), whereas REPLACEB is intended for use with languages that use the double-byte character set (DBCS). The default language setting on your computer affects the return value in the following way:

REPLACE always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

REPLACEB counts each double-byte character as 2 when you have enabled the editing of a language that supports DBCS and then set it as the default language. Otherwise, REPLACEB counts each character as 1.

The languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.

Syntax

REPLACE(old_text, start_num, num_chars, new_text)

REPLACEB(old_text, start_num, num_bytes, new_text)

The REPLACE and REPLACEB function syntax has the following arguments:

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.

Num_bytes Required. The number of bytes in old_text that you want REPLACEB to replace with new_text.

New_text Required. The text that will replace characters in old_text.

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Источник

REPLACE Function

Summary

The Excel REPLACE function replaces characters specified by location in a given text string with another text string. For example =REPLACE(«XYZ123″,4,3,»456») returns «XYZ456».

Purpose

Return value

Arguments

  • old_text — The text to replace.
  • start_num — The starting location in the text to search.
  • num_chars — The number of characters to replace.
  • new_text — The text to replace old_text with.

Syntax

Usage notes

The REPLACE function replaces characters in a text string by position. The REPLACE function is useful when the location of the text to be replaced is known or can be easily determined.

REPLACE function takes four separate arguments. The first argument, old_text, is the text string to be processed. The second argument, start_num is the numeric position of the text to replace. The third argument, num_chars, is the number of characters that should be replaced. The last argument, new_text, is the text to use for the replacement.

Examples

To replace the «C» in the path below with a «D»:

To replace 3 characters starting at the 4th character:

You can use REPLACE to remove text by specifying an empty string («») for new_text. The formula below uses REPLACE to remove the first character from the string «XYZ»:

The example below removes the first 4 characters:

Use the REPLACE function to replace text at a known location in a text string. Use the SUBSTITUTE function to replace text by searching when the location is not known. Use FIND or SEARCH to determine the location of specific text.

Источник

Find or replace text and numbers on a worksheet

Use the Find and Replace features in Excel to search for something in your workbook, such as a particular number or text string. You can either locate the search item for reference, or you can replace it with something else. You can include wildcard characters such as question marks, tildes, and asterisks, or numbers in your search terms. You can search by rows and columns, search within comments or values, and search within worksheets or entire workbooks.

Tip: You can also use formulas to replace text. Check out the SUBSTITUTE function or REPLACE, REPLACEB functions to learn more.

To find something, press Ctrl+F, or go to Home > Editing > Find & Select > Find.

Note: In the following example, we’ve clicked the Options >> button to show the entire Find dialog. By default, it will display with Options hidden.

In the Find what: box, type the text or numbers you want to find, or click the arrow in the Find what: box, and then select a recent search item from the list.

Tips: You can use wildcard characters — question mark ( ?), asterisk ( *), tilde (

) — in your search criteria.

Use the question mark (?) to find any single character — for example, s?t finds «sat» and «set».

Use the asterisk (*) to find any number of characters — for example, s*d finds «sad» and «started».

) followed by ?, *, or

to find question marks, asterisks, or other tilde characters — for example, fy91

Click Find All or Find Next to run your search.

Tip: When you click Find All, every occurrence of the criteria that you are searching for will be listed, and clicking a specific occurrence in the list will select its cell. You can sort the results of a Find All search by clicking a column heading.

Click Options>> to further define your search if needed:

Within: To search for data in a worksheet or in an entire workbook, select Sheet or Workbook.

Search: You can choose to search either By Rows (default), or By Columns.

Look in: To search for data with specific details, in the box, click Formulas, Values, Notes, or Comments.

Note: Formulas, Values, Notes and Comments are only available on the Find tab; only Formulas are available on the Replace tab.

Match case — Check this if you want to search for case-sensitive data.

Match entire cell contents — Check this if you want to search for cells that contain just the characters that you typed in the Find what: box.

If you want to search for text or numbers with specific formatting, click Format, and then make your selections in the Find Format dialog box.

Tip: If you want to find cells that just match a specific format, you can delete any criteria in the Find what box, and then select a specific cell format as an example. Click the arrow next to Format, click Choose Format From Cell, and then click the cell that has the formatting that you want to search for.

Replace

To replace text or numbers, press Ctrl+H, or go to Home > Editing > Find & Select > Replace.

Note: In the following example, we’ve clicked the Options >> button to show the entire Find dialog. By default, it will display with Options hidden.

In the Find what: box, type the text or numbers you want to find, or click the arrow in the Find what: box, and then select a recent search item from the list.

Tips: You can use wildcard characters — question mark ( ?), asterisk ( *), tilde (

) — in your search criteria.

Use the question mark (?) to find any single character — for example, s?t finds «sat» and «set».

Use the asterisk (*) to find any number of characters — for example, s*d finds «sad» and «started».

) followed by ?, *, or

to find question marks, asterisks, or other tilde characters — for example, fy91

In the Replace with: box, enter the text or numbers you want to use to replace the search text.

Click Replace All or Replace.

Tip: When you click Replace All, every occurrence of the criteria that you are searching for will be replaced, while Replace will update one occurrence at a time.

Click Options>> to further define your search if needed:

Within: To search for data in a worksheet or in an entire workbook, select Sheet or Workbook.

Search: You can choose to search either By Rows (default), or By Columns.

Look in: To search for data with specific details, in the box, click Formulas, Values, Notes, or Comments.

Note: Formulas, Values, Notes and Comments are only available on the Find tab; only Formulas are available on the Replace tab.

Match case — Check this if you want to search for case-sensitive data.

Match entire cell contents — Check this if you want to search for cells that contain just the characters that you typed in the Find what: box.

If you want to search for text or numbers with specific formatting, click Format, and then make your selections in the Find Format dialog box.

Tip: If you want to find cells that just match a specific format, you can delete any criteria in the Find what box, and then select a specific cell format as an example. Click the arrow next to Format, click Choose Format From Cell, and then click the cell that has the formatting that you want to search for.

There are two distinct methods for finding or replacing text or numbers on the Mac. The first is to use the Find & Replace dialog. The second is to use the Search bar in the ribbon.

Источник

Excel Replace Function

The Excel Replace function is similar to the Excel Substitute Function. The difference between the two functions is:

  • The Replace function replaces text in a specified position of a supplied string;
  • The Substitute function replaces one or more instances of a given text string.

Function Description

The Excel Replace function replaces all or part of a text string with another string.

The syntax of the function is:

Where the function arguments are:

old_text The original text string, that you want to replace a part of.
start_num The position, within old_text , of the first character that you want to replace.
num_chars The number of characters to replace.
new_text The replacement text.

Note that the Excel Replace Function is not suitable for languages that use the double-byte character set (e.g. Chinese, Japanese, Korean). These languages should use the ReplaceB function, which is explained on the Microsoft Office website.

Replace Function Examples

Column B of the following spreadsheet shows two examples of the Excel Replace Function.

A B
1 test string =REPLACE( A1, 7, 3, «X» )
2 second test string =REPLACE( A2, 8, 4, «XXX» )
A B
1 test string test sXng
2 second test string second XXX string

For further information and examples of the Excel Replace function, see the Microsoft Office website.

Replace Function Error

If you get an error from the Excel Replace function, this is likely to be the #VALUE! error:

Occurs if either:

  • The supplied start_num argument is negative or is a non-numeric value

or

  • The supplied num_chars argument is negative or is non-numeric.

Common Problem — Use of the Excel Replace Function with Numbers, Dates and Times

The Excel Replace function is designed for use with text strings and returns a text string. Therefore, if you attempt to use the replace function with a date, time or a number, you may get unexpected results.

If you are not planning to use the date, time or number in further calculations, you could solve this problem by converting these values into text, using the Excel Text To Columns tool. To do this:

    Use the mouse to select the cell(s) you want to convert to text (this must not span more than one column);

The Replace function should now work as expected on the values that have been converted to text.

Источник

Examples of working with text function REPLACE in Excel

REPLACE function is included in the text functions of MS Excel and is intended to replace a specific area of the text string containing the source text on the specified text line (new text).

How does the REPLACE function in Excel work?

Example 1. In order to study in detail the operation of this function, we consider one of the simplest examples. Suppose we have several words in different columns, we need to get new words using the original ones. For this example, in addition to our main function REPLACE, we also use the RIGHT function — this function serves to return a certain number of characters from the end of a line of text. That is, for example, we have two words: milk and a skating rink, as a result we must get the word hammer.

REPLACE function in Excel and examples of its use

  1. Create a table with words on the sheet of the Excel spreadsheet workbook, as shown in the figure:
  2. Next, on the sheet of the workbook, we will prepare an area for placing our result — the resulting word “hammer”, as shown below. Place the cursor in cell A6 and call the function REPLACE:
  3. Fill the function with the arguments shown in the figure:

Let us explain the choice of these parameters as follows: cell A2 was chosen as the beginning of the text, the number 5 was set as beginning_, since it is from the fifth position of the word “Milk” we don’t take characters for our final word, the number_ of signs was set equal to 2, since this number It is not taken into account in the new word, as the new text, the set option RIGHT with the parameters of the cell A3 and taking the last two characters «ok».

Next, click on the «OK» button and get the result:

How to REPLACE a piece of text in Excel cell?

Example 2. Consider another small example. Suppose we have columns of words in the cells of the Excel spreadsheet. It is necessary to replace their letters in certain places so as to convert them.

  1. Let’s create a tablet with words on the sheet of an Excel workbook, as shown in the figure:
  2. Further, on the same sheet of the working book we will prepare an area for placing our result — modified words. Fill the cells with two types of formulas as shown in the picture:

Note! In the second formula, we use the operator “&” to add the character «s» to the male surname to convert it to the female. To solve this problem, one could use the function =CONCATENATE(B3,»s») instead of the formula =B3&»s» — the result is identical. But today it is strongly recommended to abandon this formula as it has its limitations and is more demanding on resources in comparison with a simple and convenient ampersand operator.

Источник

This post will guide you how to use Excel REPLACE function with syntax and examples in Microsoft excel.

Description

The Excel REPLACE function replaces all or part of a text string with another text string

The REPLACE function is a build-in function in Microsoft Excel and it is categorized as a Text Function.

The REPLACE function is available in Excel 2016, Excel 2013, Excel 2010, Excel 2007, Excel 2003, Excel XP, Excel 2000, Excel 2011 for Mac.

Syntax

The syntax of the REPLACE function is as below:

=REPLACE (old_text, start_num, num_chars, new_text)

Where the REPLACE function arguments are:
Old_text -This is a required argument. The text string that you want to replace all or part of
Start_num – This is a required argument. The position of the first character that you want to replace within old_text.
Num_chars – This is a required argument. The number of characters that you want to replace within old_text
New_text – This is a required argument. The new text that will replace characters in old_text text string.

Note: The returned results of REPLACE function are treated as text string in EXCEL and if you are using the REPLACE function with numbers in calculations, the error message may be returned.

​There is another replace function called REPLACEB function. It is designed to work with double-type characters set. Such as: simplified Chinese.

Excel REPLACE Function Examples

The below examples will show you how to use Excel REPLACE Text function to replace part of a text string with another new text string.

#1 To replace 4 characters in B1 cell with a new text string and starting with 7th character in old_text text, just using formula:

=REPLACE(B1,7,4," replace")

excel text function replace example1

#2 you can use the Excel’s REPLACE function to replace unwanted text string in a cell with another text string or empty string.

When you copied or imported data from the external application (such as: Microsoft word), it may include unwanted characters or text string along with the good data. At this time, you can use the REPLACE function to remove it.

For example, if you want to replace the first character of the text string “#158” with a dollar sign, you can use the below REPLACE formula:

=REPLACE(B1,1,1,"$")

excel text function replace example2

You will get the result as: $158 in the above formula.

More Replace Formula Examples in Excel

  • Combining the Replace function with Text function in Excel
    we can use Replace function in combination with Text function to replace date characters that are part of the text string in excel…
  • Excel Replace function with numeric values
    how to replace a numeric characters within a text string using another numeric characters. This post will guide you how to use REPLACE function to replace numeric characters using another numeric characters in one text string….
  • Combining the Replace Function with FIND Function to Remove Text
    If you want to remove the characters before the hyphen character, then you need use FIND function to get the position of hyphen in the text, then combine with the REPLACE function …
  • Excel Replace Function Remove Text String
    If you want to remove the characters before the hyphen character, then you need use FIND function to get the position of hyphen in the text, then combine with the REPLACE function…
  • The difference between Replace function and Substitute function
    there are two similar functions to replace text string in Excel. They are REPLACE and SUBSTITUTE functions. What’s the difference between REPLACE function and SUBSTITUTE function in excel 2013?  This post will introduce the difference between those two function in excel…

  • Excel Replace function
    The Excel DATE function returns the serial number for a date.The syntax of the DATE function is as below:= DATE (year, month, day) …
  • Excel Substitute function
    The Excel SUBSTITUTE function replaces a new text string for an old text string in a text string. ….
  • Excel FIND function
    The Excel FIND function returns the position of the first text string (substring) from the first character of the second text string.The FIND function is a build-in function in Microsoft Excel and it is categorized as a Text Function.The syntax of the FIND function is as below:= FIND  (find_text, within_text,[start_num])…

Frequently Asked Questions

Question 1:

I have a number of cell that contains day name of the week, and I want to change the full day name of the week to the abbreviation of day name. How to achieve this requirement in excel.

Answer: you can use Text function or replace function to achieve it. I will show you how to use REPLACE function to change the full day name of the week, just entering the following formula to the cell B1,

=REPLACE(B1,4,6,"")

excel text function replace question1

Question2: I have a data in the excel worksheet, and I want to check if the first three characters are “sun” in a cell and then replace others characters with “.”, just keep “sun” characters in this cell. How to achieve this using excel formula.

Answer:  To achieve this, you need to use Replace function with IF function and LEFT function, using IF function to check the first characters if it is equal to “sun”, if TRUE, then call REPLACE function to remove the rest characters with “.”.  And Using LEFT function to get the first three characters of a cell.

So we can write down the following formula:

=IF(LEFT(B1,3)="sun",REPLACE(B1,4,6,"."))

excel text function replace question2

More reading: Using Find and Replace Tool to replace text in Excel

Понравилась статья? Поделить с друзьями:
  • Replace the underlined words with another word or phrase the planes engines
  • Replace all values excel
  • Replace the underlined words with a word or phrase that has a similar meaning
  • Replace all letters in word
  • Replace all images in word