How do I use a formula to make certain text a different color?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I remember using a formula to make certain text a different color and stand
out, but cannot remember the process. (e.g.- I'd like all "March" text to
automatically be in green).
 
Does your cell contain:

1. only "March"

2. "March" as part of other text, e.g. "The Ides of March"

or

3. A date formatted to read something like "3rd March 2006"?

Either way you could use

Format > Conditional formatting > formula is

=A1="march"

=SEARCH("march",A1)

or

=MONTH(a1)=3
 
is there a way to make only March's text color change in the example "ides of
march"?
 
Not with a formula or conditional formatting. You may be able to do it with
VBA, but that's a question for the .programming group.

Regards,
Fred
 
Only by VBA, not through formula.

Sub Color_String()
Dim Rng As Range
Dim Cell As Range
Dim start_str As Integer
Set Rng = Selection
For Each Cell In Rng
start_str = InStr(Cell.Value, "March")
If start_str Then
Cell.Characters(start_str, 5).Font.ColorIndex = 3
End If
Next
End Sub


Gord Dibben MS Excel MVP
 
Back
Top