Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

conditional formatting

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Conditional Formatting

Conditional Formatting

ResolvedVersion 2010

Andrew has attended:
Excel Advanced course
Excel VBA Intro Intermediate course
Excel Advanced - For Power Users course
Excel Dashboards for Business Intelligence course

Conditional Formatting

Is it possible to format a cell based on the value of a different cell?
E.g. If Cell B1 = 4 then A1 should be yellow, if it is 3 then A1 should be red and so on?

I suspect that this maybe a vba question?

Thanks,

Andy

RE: Conditional Formatting

Hi Andrew,

It is indeed possible to format one cell based on another's value.

Say you want to use cells A1 and A2. Select cell A2. In conditional formatting, select "Use a formula to determine which cells to format".

In the formula field, you type your formula. (E.g. if cell A1 has a value and you want to shade cell A2)

=$A1=1

That is the formula. Now click the Format button and assign a colour.

You have to create more colour rules for different numbers in cell A1. (e.g. =$A1=2).

You'll notice there's no $ before the row number in the formula. This enables you to copy the formatting down a column.

When you enter the number into A1, A2's colour will change.

I hope this helps.

Kind regards
Marius Barnard
Excel Trainer

RE: Conditional Formatting

Thanks Marius, what if the cell I'm trying to colour (which is where is) has text inside it?
In my workbook the scenario is like this:

J2 has text and K2 has a number - the only place I can write the formula is in J2 is it not?

Also, I have numbers ranging from 1 to 7 so this will require an IF formula.

RE: Conditional Formatting

Hi Andy,

Just to clarify, you enter the formula inside the Conditional Formatting box, not in a cell, so it doesn't matter if the cell contains data. Also, you don't need an IF function, you create separate rules for the different colours.

If you like, you could email an extract from your spreadsheet to forum@stl-training.co.uk, then we could format it so that you can see the rules in action.

Kind regards
Marius

RE: Conditional Formatting

Hi Marius, I've managed to get it to work now.
Many Thanks for your help.

Have a good weekend,

Andrew

Excel tip:

Counting Non Number Cells (Text)

If you try to use the COUNT FUNCTION =COUNT(Cell range)with a range of cells with numbers and or containing text fields you wil find that that the text cells will be excluded from the the count. If you want to include them try the the COUNTA FUNCTION =COUNTA(Cell range). This counts both text and number cell values.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.