Sub topic 4
Shading numbers with color scales
This chapter assumes you can select a range such as B2:B100 and open the Format menu. You should also know what a range's minimum, maximum, and median are. It builds on the earlier chapters about opening the conditional formatting panel and choosing which range a rule applies to.
What a color scale does
A single color rule asks a yes/no question about each cell. Either the cell matches and gets the format, or it does not. A color scale asks a different question: where does this number sit between the lowest and highest values? It then fills the cell with a color that matches that position.
The result is a heat map. Small numbers get one color, large numbers get another, and numbers in between get a blend. You can spot the strongest and weakest values in a column without reading any of them.
Color scales fit data like these:
- Monthly sales by region
- Test scores
- Response times
- Temperatures
- Survey ratings
- Dates, because Sheets stores dates as numbers
They are a poor fit for categories such as "Done" or "Blocked". Those need single color rules or custom formulas, which later chapters cover.
Creating a color scale
- Select the numeric cells, for example
B2:B13. - Open Format > Conditional formatting. The rules panel opens on the right.
- At the top of the panel, switch from Single color to Color scale.
- Check the Apply to range box. It should show the cells you selected.
- Under Format rules, pick a preset from the Preview strip, or set the points yourself.
- Click Done.
The panel shows three points: Minpoint, Midpoint, and Maxpoint. Each has two settings, a type and a color. The Midpoint is optional. Without it you get a two-color gradient. With it you get a three-color gradient.
The point types
Each point is defined by a type, and some types also take a value.
| Type | What it means | Needs a value? |
|---|---|---|
| Min value (on Minpoint) | The lowest number in the range | No |
| Max value (on Maxpoint) | The highest number in the range | No |
| Number | A fixed number you type | Yes |
| Percent | A position between the range's min and max, 0 to 100 | Yes |
| Percentile | A rank within the data, 0 to 100 | Yes |
The default is "Min value" for the Minpoint and "Max value" for the Maxpoint. This means the scale adjusts itself whenever the data changes. The lowest number always gets the first color, and the highest always gets the last.
How Sheets picks a color for each cell
The logic is the same for every cell:
- If a cell's number equals a point's value, it gets that point's color exactly.
- If it falls between two points, Sheets blends the two colors in proportion to how far along the cell is.
- If it falls below the Minpoint or above the Maxpoint, it gets the end color. The color does not continue past the ends.
- Cells that are blank or contain text are not shaded.
Number, Percent, and Percentile
The three value-based types sound alike, but they give different results on the same data. Take this column:
| Cell | Value |
|---|---|
| B2 | 1 |
| B3 | 2 |
| B4 | 3 |
| B5 | 4 |
| B6 | 100 |
Suppose the Midpoint is set to 50 and its type changes:
- Number 50: the midpoint color lands on the value 50. No cell holds 50, so four cells sit in the lower half of the gradient, and only the 100 reaches the top.
- Percent 50: the midpoint sits halfway between the minimum (1) and the maximum (100), which is 50.5. The result is almost the same as Number 50 here, but it follows the data if the extremes change.
- Percentile 50: the midpoint is the median, which is 3. Half the cells fall on each side, no matter how extreme the 100 is.
You can check these numbers in empty cells with ordinary formulas:
=MIN(B2:B6)=MAX(B2:B6)=PERCENTILE(B2:B6,0.5)The first returns 1, the second 100, and the third 3. The PERCENTILE function takes a fraction from 0 to 1, while the panel takes a number from 0 to 100.
Choosing between them
- Use Min value and Max value for a quick look at the full spread. Be aware that one outlier compresses everything else into a narrow color band.
- Use Percent when you want the scale to stretch over the actual range but with a midpoint that is not the median.
- Use Percentile when outliers would wash out the picture. Setting the Minpoint to Percentile 5 and the Maxpoint to Percentile 95 means the top and bottom 5% of values all get the end colors. The middle 90% then show more variation.
- Use Number when the thresholds have meaning, such as 0 for "break-even" or 70 for "passing grade."
Two-color and three-color scales
A two-color scale uses only a Minpoint and a Maxpoint. White to green is common: pale cells are low and saturated cells are high. This works well when the data only runs in one direction, such as counts.
A three-color scale adds a Midpoint, so the data can diverge from a meaningful center. Examples:
- Profit and loss around zero
- Scores above or below an average
- Temperatures above or below freezing
To build a diverging scale around zero:
- Set the Minpoint to Min value with a red color.
- Set the Midpoint to Number
0with a white color. - Set the Maxpoint to Max value with a green color.
Negative numbers fade from red to white as they approach zero. Positive numbers fade from white to green as they grow. Zero is white.
Reversing the direction
Green is not always good. For response times or error counts, a high number is bad. You do not need a special setting for this. Choose the colors in the opposite order: put green on the Minpoint and red on the Maxpoint. The presets in the Preview strip include both orientations, and you can also click each color swatch to pick your own.
Which range gets one scale
The range you apply the rule to decides what "lowest" and "highest" mean. This catches many people.
If you apply one color scale to B2:D13, Sheets finds the min and max across all 36 cells and uses one scale for all of them. A cell in column B and a cell in column D with the same number get the same color.
If the columns measure different things (sales in dollars and satisfaction on a 1 to 5 scale), that single scale is wrong. The dollars will dominate. Create one rule per column instead:
- A rule on
B2:B13 - A rule on
C2:C13 - A rule on
D2:D13
If you want each row compared with its own row, apply a separate rule to each row. This is tedious, so most people choose a different technique for that case.
You can list several ranges in the Apply to range box, separated by commas, such as B2:B13, F2:F13. Those ranges are treated as one pool when Sheets finds the min and max.
What happens when data changes
Color scales are live. If you edit a number, the color updates. If the new number becomes the new maximum, the other cells shift to a lighter shade because the scale stretches to the new maximum. This is an advantage when you want a relative view and a drawback when you want a stable one.
If you need a stable meaning, such as "dark green always means 90 or above," use Number types for the points. Then the colors depend on the fixed thresholds you typed and not on whatever data happens to be in the range.
Also note what is part of the range:
- Header rows: if you include a header cell like "Sales" in the range, Sheets ignores it because it is text. Starting at row 2 is still cleaner.
- Inserted rows: inserting a row inside the range expands the range, and the new row is included. Appending a row after the last row does not expand it, so edit the range to something like
B2:B1000if you add data often. - Empty cells: blanks are skipped. They do not count as zero.
- Zeros: a real
0is a number and does count. A column with many zeros will shape the scale if the Minpoint is "Min value." - Text that looks like numbers: a value such as
'42stored as text is not shaded. If numbers show up unshaded, check that they are real numbers (they right-align by default, and text left-aligns).
Worked example: a sales heat map
Imagine a sheet with monthly sales per region:
| Row | A | B | C |
|---|---|---|---|
| 1 | Region | Jan | Feb |
| 2 | North | 12000 | 15500 |
| 3 | South | 8000 | 7200 |
| 4 | East | 21000 | 19800 |
| 5 | West | 9500 | 31000 |
Goal: shade B2:C5 so the best cells are dark green and the weakest are red, with the middle yellow.
- Select
B2:C5. - Open Format > Conditional formatting and choose the Color scale tab.
- Set Minpoint to Min value, red.
- Set Midpoint to Percentile
50, yellow. - Set Maxpoint to Max value, green.
- Click Done.
The lowest value (7200) is red, and the highest (31000) is green. The median of the eight values is the yellow point, so about half the cells lean red and half lean green. If you had used Percent 50 instead, the yellow would sit at 19100, halfway between 7200 and 31000. Because 31000 is far above the rest, most cells would then fall in the red half.
To confirm what the scale is using, put these in spare cells:
=PERCENTILE(B2:C5,0.5)=(MIN(B2:C5)+MAX(B2:C5))/2The first gives the Percentile 50 value (the median), and the second gives the Percent 50 value. Comparing them tells you how much the choice of type would change the picture.
Common mistakes
- One scale across unlike columns. Apply separate rules per column when units differ.
- Using Min value and Max value with an outlier. Switch to Percentile for the end points.
- Expecting a color scale to highlight a whole row. A color scale colors only the cells in its range, based on each cell's own number. Whole-row highlighting needs a custom formula rule.
- Forgetting that Percent and Percentile are 0 to 100 in the panel. Typing
0.5means the 0.5th percent, not the middle. - Reading colors as exact amounts. Shades are for comparison, not measurement. Keep the numbers visible.
Exercise
A column holds 40, 42, 45, 47, and 900. You apply a white-to-green scale with Min value and Max value. Almost every cell looks white. Name one change to the points that makes the four smaller values easier to tell apart, and say why it works.
Show answer
Change the Maxpoint type from Max value to Percentile, for example Percentile 80 or 90 (or to a Number such as 50). The 900 is the maximum, so with Max value it stretches the scale far above the other four values and they all fall near the white end. A Percentile or fixed Number Maxpoint puts the top color near the cluster of normal values. The 900 is simply capped at the top color, and 40 to 47 are spread across the gradient.
Exercise
Profit figures in B2:B20 include both losses and gains. You want losses red, gains green, and exactly zero white. Which three point settings do you use?
Show answer
Minpoint: Min value, red. Midpoint: Number 0, white. Maxpoint: Max value, green. The Number type pins the white color to zero, whatever the minimum and maximum are.
Exercise
You apply one color scale to B2:D13, where B holds dollar sales and D holds ratings from 1 to 5. The ratings column looks uniformly pale. Why, and what do you do about it?
Show answer
A single rule on several columns uses one minimum and maximum across all of its cells. The dollar values set a huge maximum, so the ratings from 1 to 5 all sit at the minimum end of the gradient. Remove the combined rule and create a separate color scale rule for each column, so each one has its own minimum and maximum.