How to Find and Replace Text Color in Excel: 3 Quick Methods

Method 1 – Using Find and Replace Feature to Change Text Color

Steps:

  • Select the range of cells from where you need to find the Text.
  • Click on Find & Select under the Home tab.
  • From the drop-down menu, click on Replace

Selecting Replace Option of Find & Select Feature in the Home ribbon

  • A dialog box named Find and Replace will appear. Under the Replace tab, Click on Options.

Selecting Options to Format in the Find and Replace wizard

  • In the Find what: box, write down the text you want to find and click on Format… beside the Replace with: box.

Writing the Targeted Text and Selecting Replacing Criteria

  • A window named Replace Format will appear. Click the Font tab.
  • Click-on Color. Select a color according to your preference.

Choosing the Font Color of the Text 

  • Press OK.

Finalizing Formatting Task in the Replace Format Window

  • Inside the Find & Select box, press Replace All.

Pressing Replace all Command to Change the Font Colors of the Found Words

  • All the targeted text colors will be changed.

Results Showing Changed Text Colors after Applying Find and Replace Feature


Method 2 – Find and Replace Text Color Manually

Steps:

  • Select all the texts you want to change the colors. (By pressing CTRL on the keyboard, you can select the cells consequently)
  • Click on the Font Color icon under the Home tab and choose any default or custom colors.
  • The selected texts have different colors.

GIF Showing the Steps of Changing Text Color Manually


Method 3 – Applying VBA Code to Find and Replace Text Color

Steps:

  • Click on Visual Basic under the Developer tab.

As a note, if you’re having trouble finding the Developer tab, follow this article to go through the steps.

Opening Visual Basic in the Developer Tab

  • A new window named Microsoft Visual Basics for Applications will open.
  • Click on Insert and select Module from the drop-down menu.

Inserting Module to Start Writing the Code.

  • Inside the module write down your macro to change the color of a specific text, every time it appears anywhere in the sheet or the entire workbook.

VBA Code to Find and Replace Text Color in Excel

Sub change_text_color()

input_word = InputBox("What word to change")
txt_len = Len(input_word)

For Each cell In Selection
    For x = 1 To Len(cell.Value)
        On Error Resume Next
        wrd = 0
        wrd = Application.WorksheetFunction.Find(input_word, cell.Value, x)
        On Error GoTo 0
        If wrd > 0 Then
            cell.Characters(Start:=wrd, Length:=txt_len).Font.Color = RGB(255, 0, 255)
            x = wrd + 1
        Else
            Exit For
        End If
    Next x
Next cell
End Sub

Code Breakdown:

In this section, we’ll explain the VBA code used to find and replace text color in Excel.

  • Name the subroutine, here it is change_text_color().
  • Prompt the user for a target word and store it in the input_word variable.
  • Apply the Len function to determine the number of characters.
  • Nest multiple For Next loops to go through all the cells in the selected range, using the Find method to locate them.
  • Apply an If Then statement to apply color to the matched words.
  • Go back to your Excel sheet and click on Macros under the Developer tab.
  • Select the macro, in this case, change_text_color and click on Run.

Executing VBA Macro

  • A prompt will appear asking you, “What word to change?” Type the word and press OK.

Typing the Desired Text and clicking ok.

  • The word’s color will change in every cell without changing the text colors of the other words inside the same cells.

Results of Find and Replace Text Color in ExcelUsing VBA Code


How to Change Text Color in Excel Using Formula

Steps:

  • Choose the range from where you need to find the text.
  • Press Conditional Formatting in the Styles section.
  • From the drop-down menu, place the cursor on Highlight Cells Rules and select a condition according to your need.
  • A dialog box will open. There, type your conditional argument.
  • Press OK. The text colors will be changed accordingly.

GIF Showing the Process of Changing Text Color Using Formula in Conditional Formatting

 


How to Change Font Color Based on Value in Excel

Steps:

  • Select the cells.
  • Choose Conditional Formatting and select the New Rule option.
  • This opens the New Formatting Rule wizard. Select Use a formula to determine which cells to format.
  • Inside the Format values where this formula is true: box, type your conditional formula. An example could be:
=ISEVEN(G5)

which would mark the even numbers residing in column G.

  • Click on Format. Choose any color under the Font tab.
  • Press OK (Format Cells box). Press OK (New Formatting Rule box).
  • The colors of the texts that match the conditional formula value, will be changed accordingly.

GIF Showing the Steps of Changing Font Color Based on Value with  Conditional Formatting

We skipped some relevant examples of how to change font color based on value, which you may explore.


Download Practice Workbook

You can download and practice the dataset we used to prepare this article.


Related Articles


<< Go Back to Find and Replace | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Md. Nafis Soumik
Md. Nafis Soumik

Md. Nafis Soumik graduated from Bangladesh University of Engineering & Technology, Dhaka, with a BSc.Engg in Naval Architecture & Marine Engineering. In January 2023, he joined Softeko as an Excel and VBA content developer, contributing 50+ articles on topics including Data Analysis, Visualization, Pivot Tables, Power Query, and VBA. Soumik participated in 2 specialized training programs on VBA and Chart & Dashboard designing in Excel. During leisure, he enjoys music, travel, and science documentaries, reflecting a diverse range... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo