Kiran
Kiran

Reputation: 23

Formatting cell based on adjacent cell value

I would like a cell to be color filled or formatted based on the value in the adjacent cell. For example, if cell D1= #NA then I want the font in C1 to be filled in red.I would like to compare entire range in column C and D for this. Is there any conditional formatting rules or VBA macro that can accomplish this?

Upvotes: 0

Views: 2939

Answers (4)

12V_man
12V_man

Reputation: 36

Conditional Formatting can do this. Pick the "Use a formula to determine which cells to format", enter

=7=ERROR.TYPE(D1)

Set the red fill. Now copy & apply to entire column.

Upvotes: 0

xidgel
xidgel

Reputation: 3145

To apply such a format to C3 based on the contents of D3:

  1. Select C3
  2. In Conditional Formatting click New Rule...
  3. Select "Use a formula to determine which cells to format"
  4. For the formula enter "=ISNA($D$3)"
  5. Click the Format button to set up the format that gets applied when the previous formula returns TRUE

Hope that helps

Upvotes: 1

AlexHirst
AlexHirst

Reputation: 1

Conditional formatting would be easiest way to do this.

If under conditional formatting you select new rule and then "use a formula to determine which cells to format". A formula such as =$D$1="#na" and change the format to what you would like. If you click OK and make sure this applies to C1 and stop if true is selected.

This worked for me! If you would like to use vba then let me know.

Upvotes: 0

bbishopca
bbishopca

Reputation: 296

Very simply select the range you want in column C and just make a conditional format using an equation and use

=$D1=""

and change the format text color to what ever you want.

Upvotes: 1

Related Questions