Excel - IF statement checking if a cell's text is red

Asked By Shazze on 07-Sep-07 09:40 AM
I want to say :-
IF the text in A1 is formatted Red then, "yes" else "no"

Is there any way I can do this?

Ta v much




MartinW replied on 07-Sep-07 10:03 AM
Hi Shazzer,

You may be able to adjust this to your needs.
http://xldynamic.com/source/xld.ColourCounter.html#sorting

HTH
Martin
RayportingMonke replied on 07-Sep-07 10:06 AM
I would think that depends on the criteria you are using to turn the text
red... If you are using conditional formatting, then the IF statement would
mirror that of the conditional formatting.

What is the criteria you are using for the red text?
Shazze replied on 07-Sep-07 10:34 AM
The red cells have just been manually set.
Jason replied on 07-Sep-07 10:53 AM
I think you would have to make a new function.  There's a built in
function that gives information about the target cell, CELL, but it
doesn't return the actual color of the text.  I'm no expert, so this
example if really basic, but should work.  Put the following text into
a module in the spreadsheet in which you want to use the function:

Function CheckRed(target As Range)

Application.Volatile
If target.Font.Color = 255 Then
CheckRed = "Yes"
Else
CheckRed = "No"
End If

End Function

In the cell that you would have put your IF statement, use this:

=CheckRed(A1)

Hope this helps.
Darren Bartru replied on 07-Sep-07 11:50 AM
Create a named range (Insert ~ Name ~ Define)

In the Define Name dialog box enter a name in the 'Names in workbook:' box
(e.g. RedCell).

In the 'Refers to:' box enter this formula:
=IF(GET.CELL(63,Sheet1!$A$1)=3,"Yes","No")

alternatively use:
=IF(GET.CELL(63,INDIRECT(ADDRESS(0,-1,4,FALSE),FALSE))=3,"Yes","No")

which will return Yes if the cell to the immediate left of the cell
containing the formula is red (change the 0 & -1 to refer to different
rows/columns).

Regards,
Darren.