Archive of Mr Excel Message Board


Back to Forms in Excel VBA archive index
Back to archive home

Conditional format based onother cells

Posted by Jim on October 15, 2001 6:51 AM
Without using a macro,is it possible to format a cell based on conditions in other cells? For example, format C1 as yellow background if A1>100 but format C1 as red background if B1>100, else leave C1 formatting as is. Can =IF be used to change formatting?

What happens to C1 if

Posted by Aladin Akyurek on October 15, 2001 7:01 AM

A1>100 and B1>100 at the same time?

Aladin

========


Re: What happens to C1 if

Posted by Jim on October 15, 2001 7:03 AM
In that case, B1 takes precedence so red background.


Re: Conditional format based onother cells

Posted by Dan on October 15, 2001 7:11 AM
Highlight C1, choose Format-> Conditional Formatting. Under Condition 1, choose Formula Is. In the field to the right type in "=A1>100" (without quotes). Then click the Format button and under the Patterns tab choose yellow color. Then click OK. To add your 2nd condition click on the Add>> button and you will get more fields to specify your other condition. Have fun! HTH


Re: Conditional format based onother cells

Posted by Dan on October 15, 2001 7:15 AM
Sorry I didn't notice that you had >100 on both conditions. You would want to make the "default" one the first condition, and the secondary one the 2nd condition. That should work. HTH.


Re: Conditional format based onother cells

Posted by Aladin Akyurek on October 15, 2001 7:59 AM
Jim,

Activate C1.
Activate Format|Conditional Formatting.
Select "Formula Is" for Condition 1.
Enter as formula:

=AND(A1>100,B1<=100)

Activate Format.
Select Yellow on the Patterns tab.
Click OK but don't leave the Conditional Formatting dialog.
Activate Add.
Select "Formula Is" for Condition 2.
Enter as formula:

=B1>100

Activate Format.
Select red on the Patterns tab.
Click OK.
Click OK.

Aladin

==========


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.