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

J

J Wood

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).
 
D

daddylonglegs

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
 
M

Marc''s NYK

is there a way to make only March's text color change in the example "ides of
march"?
 
F

Fred Smith

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
 
G

Gord Dibben

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top