ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I color cells within a formula in excel? (https://www.excelbanter.com/excel-worksheet-functions/17351-how-do-i-color-cells-within-formula-excel.html)

Richard

How do I color cells within a formula in excel?
 
I am trying to format a cell so that if a value is greater than 5 the cell
will be coloured Red, if it is between 2 and 4 it will be Orange and if it is
between zero and 1 it will be Green, how do I do it?
I tried to use the IF function but it didn't seem to work.

Niek Otten

Use FormatConditional formatting

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"Richard" wrote in message
...
I am trying to format a cell so that if a value is greater than 5 the cell
will be coloured Red, if it is between 2 and 4 it will be Orange and if it
is
between zero and 1 it will be Green, how do I do it?
I tried to use the IF function but it didn't seem to work.




Bob Phillips

Look up 'Highlight cells that meet specific conditions' in the Answer
wizard in help

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Niek Otten" wrote in message
...
Use FormatConditional formatting

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"Richard" wrote in message
...
I am trying to format a cell so that if a value is greater than 5 the

cell
will be coloured Red, if it is between 2 and 4 it will be Orange and if

it
is
between zero and 1 it will be Green, how do I do it?
I tried to use the IF function but it didn't seem to work.






David McRitchie

Hi Richard,
A bit more information, and suggest you read
Conditional Formatting
http://www.mvps.org/dmcritchie/excel/condfmt.htm

FormatConditional formatting
cond 1: =A1=5 format pattern for Red
cond 2: =A1=2 format pattern for Orange
cond 3: =A1=0 format pattern for Green
Enter them in the above order because when you get a
match the rest are going to be checked.

The formula is based on your active cell, the cells that
get colored are based on your selection.

If you have more than 3 conditions you would need to use an
Event Macro, and hopefully you would be working with constants
rather than formulas so you can use a Change Event macro.
http://www.mvps.org/dmcritchie/excel/event.htm

With normal cell formatting instead you can try the following, but it
will color ONLY the font, you cannot format the cell colour
with normal cell formatting. The third part (all other numbers)
will color negative numbers as well.

Format cells Custom
[Red][=5]General;[Color40][=2]General;[Color10]General;[Color30]@

Also on a laptop font colors are not very easily distinguishable,
and dark colors are hard to distinguish for interior colors. Your
colors if used for interior colors with Conditional Formatting would
be easy to distinguish.

More information on Colors
http://www.mvps.org/dmcritchie/excel/colors.htm

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Niek Otten" wrote
Use FormatConditional formatting

"Richard" wrote...
I am trying to format a cell so that if a value is greater than 5 the cell
will be coloured Red, if it is between 2 and 4 it will be Orange and if it
is
between zero and 1 it will be Green, how do I do it?
I tried to use the IF function but it didn't seem to work.







All times are GMT +1. The time now is 01:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com