Formating text

G

gilbert

Hi,

Just wonder if we can set preferred colour text to the text appearing
using If, Then, Else function? For example, a function having the
following :-

=if(A1="","Error","OK")

I want the word "Error" to appear in red colour when cell A1 is in
blank and the word "OK" to appear in blue colour when cell A1 is filled
up. I know we can do it using Conditional Formatting but that is only
for 1 condition, but for my situation, there are two conditions.

Also, can we set conditional formatting to format the text if it is
number, if word is displayed, no action to take.

Please help....
 
M

millsy

gilbert said:
*Hi,

Just wonder if we can set preferred colour text to the text appearing
using If, Then, Else function? For example, a function having the
following :-

=if(A1="","Error","OK")

I want the word "Error" to appear in red colour when cell A1 is in
blank and the word "OK" to appear in blue colour when cell A1 is
filled up. I know we can do it using Conditional Formatting but that
is only for 1 condition, but for my situation, there are two
conditions.

Also, can we set conditional formatting to format the text if it is
number, if word is displayed, no action to take.

Please help.... *

You can have more than one condition with Conditional Formatting.
Enter your condition and press the "Add" button and you are offered the
chance to enter another conditon.

In the case that you describe you only need one condition anyway since
the cell can only be blank or not blank. You could set the normal
colour to blue and conditionally format it red if cell A1 is blank.
 
M

Max

Assuming your formula is in B1: =if(A1="","Error","OK")

Select B1

Click Format > Conditional Formatting

Under Condition1, make the settings:
Formula Is: | =ISBLANK(A1)
Click Format button > Font tab > Red & Bold > OK

Click "Add>>" button
(this adds the 2nd condition)

Under Condition2, make the settings:
Formula Is: | =NOT(ISBLANK(A1))
Click Format button > Font tab > Blue & Bold > OK

Click OK at the main dialog

That should do it

------------------------
As for your other Q:
Also, can we set conditional formatting to format the text if it is
number, if word is displayed, no action to take.

Let's assume C1 also has the formula
: =if(A1="","Error","OK")

Select C1

Click Format > Conditional Formatting

Under Condition1, make the settings:
Formula Is: | =ISNUMBER(A1)
Click Format button > Font tab > Red/Bold (say) > OK

Click Add>> button

Under Condition2, make the settings:
Formula Is: | =ISTEXT(A1)
Leave it as "No Format Set"

Click OK at the main dialog
------------

To copy the conditional formatting down cols B & C:

Select the formatted range B1:C1

Double-click on the Format Painter icon ("brush")
[cursor will turn into "brush"]

Click to select [i.e. "paint"] over the range say, B2:C100
(assuming the last row is row100)

Press Esc to revert the cursor to normal
 

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