IF to check color of text

  • Thread starter Thread starter eckaner
  • Start date Start date
E

eckaner

I have a calendar made up of my work schedule. I have the days that
am working a font color of black. I have the days that I am off a fon
color of light gray.

I'm looking to use an IF function in which detects the font color, an
if true, add eight, otherwise add zero.

Is this possible?

E
 
Hi Ed

Push Alt+F11 and go to Insert>module in here copy and paste the code
below

Function FontColor(CompareCell As Range, _
CheckCell As Range) As Boolean
FontColor = CompareCell.Font.ColorIndex = _
CheckCell.Font.ColorIndex
End Function


Now click the top right X to get back to Excel. In any cell enter;

=IF(FontColor(B4,B5),B5+8,B5)

Where B4 is a cell with the required Font color and B5 is the cell to
check the Font color of. You could also shorten to

=B5+FontColor(B4,B5)*8

Just be aware that changing a Font's color will *not* cause a
recalculation. You need to either, re-enter the formula, or use Paste
Special Formats to change Font color.

** Posted via: http://www.ozgrid.com
Excel Templates, Training, Add-ins & Business Software Galore!
Free Excel Forum http://www.ozgrid.com/forum ***
 
Back
Top