Excel training
First written: Feb-2024
last changed Mar-2024
last changed Mar-2024
Adding Conditional Formatting on a column
Here we want to make the Salary column to have a red background if the amounts shown are less that 60,000.
- Click on the column header for column
D
- Click on the Conditional Formatting field on the Styles tab of the Home ribbon on the top of the screen,
Then select Highlight Cells Rules and Less Than... - Change the value in the field on the popup to read
£60,000
and set the with field toLight Red Fill with Dark Red Text
, then click [OK] - We should now see that this has actually caused a problem, in that although it has applied the designed formatting, it has also applied it to all cells below our data too (i.e.
D22
and beyond). To fix this - undo this action using the keyboard buttons [CONTROL]-Z (a standard Windows keyboard action) and then apply the formatting again but instead of selecting the wholeD
column, selectD2
and drag down toD21
** - then apply repeat the formatting steps
** IMPORTANT TIP: To select all active cells in a column, you can also simply click on the top cell D2
and then use [CONTROL]+[SHIFT]+[DOWN ARROW] on the keyboard - this is actually the recommended method for this kind of action.
Advanced Tip
- Click on cell
B2
- From the Conditional Formatting drop down list of options, click on New Rule.... to create a custom rule
- Now select Use a formula to determine which cells to format and then type in
=E2=1
in the Format values where this formula is true: field (IMPORTANT: this value should start with the equals sign, otherwise the result is put into quotes and not work as expected)
- Still on the popup, click on the [Format] button, then select the Fill tab, and select a green
- Click [OK] from the Format Cells popup
- Click [OK] on the New Formatting Rule popup
- Click on cell
B2
and then click on the Format Painter (paintbrush) icon (you should see the cursor changes to a paintbrush) - Select cells
E21
through toE2
to apply the formatting to all the selected cells
Background Notes (IMPORTANT)
To see what has happened, or to adjust the formatting
- Click on one of the selected cells, e.g.
E9
- Click on Conditional Formatting from the ribbon
- Click on Manage Rules....
- Click on the first rule in the Rule list
- Note that the Applies to value reads
=$B$2:$B$21
($B means "always B regardless of where you apply this formula", and $2 means "always row 2 regardless of where you apply the formula") - Click on [Edit Rule...]
- Note that the Format reads
=E2=1
even though you are looking atE9
If you were to add new rows in to the table then this may need to be revised
chevron_leftStep-11-utilising-binary-cells
Step-13-adding-text-cellschevron_right
Comments
New Comment