Font colours in formulae

Panikos

New Member
Joined
Aug 18, 2002
Messages
9
I would like to write an "IF" function where when the answer is right then the result will come up in a colour(e.g.blue) and if it it is wrong it would come up in a different colour(e.g.red).

Thanks
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

ChrisUK

Well-known Member
Joined
Sep 3, 2002
Messages
675
What do you mean by "come up" ?

Have you looked at conditional formatting ? that might hold your answer.

HTH

Chris
 

Richie(UK)

MrExcel MVP
Joined
May 17, 2002
Messages
3,329
Hi Panikos,

You need to use Conditional Formatting.

Go to Format on the main menu and then select Conditional Formatting. Enter the details that are relevant for your situation and then choose the desired formatting, eg red font for a negative value.

HTH
 

Mark W.

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,654
On 2002-10-15 09:54, Panikos wrote:
I would like to write an "IF" function where when the answer is right then the result will come up in a colour(e.g.blue) and if it it is wrong it would come up in a different colour(e.g.red).

Thanks

This can also be accomplished (to a limited extent) using custom number formatting. For discussion purposes suppose a "right" result if >= 0 and a "wrong" one is negative. The following number format would accomplish your objective...

[Blue][>=0]General;[Red]-General

For more on custom number formatting see the Excel Help topics for "Create a custom number format" and "About number format codes for decimal places, spaces, colors, and conditions".
 

Jack in the UK

Well-known Member
Joined
Feb 16, 2002
Messages
3,215
Hi Try this add to the sheet module as is and test

Edit is easy need to keep array the same add words to same number of colour choices, play arroud good fun

Jack

||||||||||||||||||

Option Base 1
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next

' Dedicated to all the guys who help +
' support Jack on this board thanks so much

Dim Names As Variant
Dim Colours As Variant
Dim x As Integer
Dim y As Integer
Names = Array("Jack", "UK")
'Above are object to the text in these cells
' these wil also colour that word to @cool eh!@
Colours = Array(6, :cool:
' 6 - Yellow
' 8 - Blue
For x = 1 To UBound(Names)
y = InStr(1, Target.Value, Names(x))
If y > 0 Then
With Target.Characters _
(Start:=y, _
Length:=Len(Names(x))).Font
.ColorIndex = Colours(x)
.FontStyle = "Bold"
End With
End If
Next x
End Sub
 

Forum statistics

Threads
1,144,446
Messages
5,724,400
Members
422,550
Latest member
Parvin_B

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top