Simpliguides

Simpliguides › Productivity

How to use conditional formatting in Google Sheets to highlight cells automatically

Conditional formatting is a rule that colours a cell when its contents meet a condition you set — a number above a limit, a particular word, a date that has passed. Once the rule exists, the colour appears and disappears on its own as the data changes. This guide sets up one rule in the desktop browser version of Google Sheets.

What you'll need: A Google account and a spreadsheet you can edit. A desktop or laptop browser — Chrome, Firefox, Safari or Edge. The Sheets mobile app has the same feature but the screens differ, so these steps don't match it exactly.

1

Open the spreadsheet

Go to sheets.google.com, sign in if asked, and open the spreadsheet you want to work on.

2

Select the cells the rule should cover

Click the first cell and drag to the last one. To cover a whole column, click the letter at the top of it instead.

Select the cells you want to colour, not the cells you are checking. For a simple rule they are the same cells. If you want one cell's value to colour a different cell, see the Variations section below.
3

Open the conditional formatting panel

Click Format in the menu bar, then Conditional formatting. A panel headed Conditional format rules opens on the right-hand side, with the Single colour tab selected.

4

Check the range

The Apply to range box shows the cells you selected, for example B2:B50. If it isn't right, click in the box and type the range you want, or click the grid icon next to it and select the cells again.

5

Choose the condition

Under Format cells if…, click the dropdown. It starts on Is not empty. Pick the test you want — the list includes Text contains, Text is exactly, Date is before, Greater than, Less than, Is between and Is empty, among others.

For this example, choose Greater than to flag any figure over a limit.

6

Enter the value to compare against

A text box appears beneath the dropdown. Type the number, word or date the rule should check for. For a spending limit of £1,000, type the figure without the currency symbol or comma:

1000
For text conditions such as Text contains, capital letters don't matter — overdue matches Overdue and OVERDUE.
7

Pick how matching cells should look

Under Formatting style, the rule starts with a light green fill. To change it, click the fill colour icon (the paint bucket) and pick a colour. The row of icons alongside it lets you make the text bold, italic, underlined or struck through, and change the text colour.

The cells in your range that already match the condition change colour as you go, so you can see the effect before saving.

8

Save the rule

Click Done at the bottom of the panel. The rule is now live. Type a new value into any cell in the range and the colour updates straight away.

Close the panel with the × in its top-right corner when you're finished.

Variations

Colour a whole row based on one cell

Select every column you want coloured — say A2:F100 — then in step 5 choose Custom formula is from the bottom of the dropdown. In the box, type a formula that refers to the first row of the range, with a dollar sign before the column letter and nothing before the row number:

=$D2="Overdue"

Sheets applies the test row by row, so the whole of any row whose column D says Overdue gets the colour. Change D to whichever column holds the value you're checking.

Shade cells from low to high instead of one colour

In the panel, click the Colour scale tab instead of Single colour. Sheets colours the lowest value in the range one colour, the highest another, and blends everything in between. The default runs from white to green. Click the preview bar to choose a different preset, or set the Minpoint, Midpoint and Maxpoint colours individually.

Flag dates that have already passed

Select the column of dates, choose Date is before in step 5, and pick today from the second dropdown that appears. Anything earlier than today's date is highlighted, and the highlight moves on by itself each day.

Troubleshooting

Numbers aren't being highlighted even though they're over the limit

The cells probably hold text that looks like a number, which often happens with figures pasted in from elsewhere. Text sits against the left edge of a cell by default, while a true number sits against the right. Select the cells, click Format › Number › Number, and if they still won't convert, retype one by hand to confirm the rule itself works.

Two rules overlap and only one of them shows

When a cell matches more than one rule, Sheets uses the one listed highest in the panel and ignores the rest. Open Format › Conditional formatting, then drag the rules into the order you want using the dotted handle on the left of each one.

I want to change or remove a rule

Open Format › Conditional formatting with any cell in the range selected. Click a rule to edit it, or hover over it and click the bin icon to delete it. The panel only lists rules that apply to the selected cells, so if the one you want is missing, click a cell that it covers.

Advertisement

Need a calculator rather than a guide? Try Simplicalcs →