# Color a cell based on its value

#### TCL28

##### New Member
Goodafternoon,
Is it possible to color cell B1 red if cell A1 contains a 0 and color B1 green if A1 contains a 1? Thank you.

Tom

### Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Use Format|Conditional Formatting while in B1

Use conditional formatting.

Select B1 and go to Format\Conditional Formatting

Enter

Formula Is | =AND(ISBLANK(\$A\$1)=FALSE,\$A\$1=0)
and click the Format button to set the color to red.

Enter:
Formula is | =\$A\$1=1
and click the format button to set the color to green.

Thank you all

Replies
1
Views
269
Replies
2
Views
424
Replies
1
Views
383
Replies
9
Views
614
Replies
2
Views
220

1,203,199
Messages
6,054,081
Members
444,702
Latest member
patrickmg17

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back