Sub topic 12
Borders, Fill Colors, and Alternating Colors
This chapter covers the formatting that shapes a sheet's structure: borders, fill colors, and alternating colors. It assumes you can select ranges, type values, and apply basic text formatting such as bold and font color. You do not need formulas yet, though the last section previews how they connect to conditional formatting.
What borders and fills do
Borders and fills are cell formats. They change how a cell looks and nothing else. A cell with a yellow fill holds the same value as a cell with no fill. Formulas ignore both, and sorting and filtering carry them along with the row rather than evaluating them.
That gives you a rule for choosing between them:
- Use a border to show structure: where a table starts, where it ends, which cells belong together.
- Use a fill color to show emphasis or category: a header row, an input area, a total.
Both are static. If you color a cell red by hand and the number inside changes, the color stays. When the color should follow the data, you need conditional formatting, which a later chapter covers.
Applying borders
Select a range, then open the Borders button in the toolbar. If the toolbar is collapsed, look under the three-dot More menu. The menu has these parts:
| Option | Effect on the selected range |
|---|---|
| All borders | Lines around every cell |
| Inner borders | Lines between cells only |
| Horizontal borders | Lines between rows only |
| Vertical borders | Lines between columns only |
| Outer borders | A box around the whole selection |
| Left, top, right, bottom | One edge of the selection |
| Clear borders | Removes all borders in the selection |
The menu also has a Border color option and a Border style option. The style options are solid, dotted, dashed, and thicker solid lines. Set the color and style before you pick a border position. The color and style you choose apply to the next border you add. They do not recolor borders already on the sheet.
Layering borders
Borders stack. You can apply inner borders in light gray, then outer borders in thick black, and get a table with soft grid lines and a strong frame. Apply the layers in that order. If you apply outer borders first and then all borders, the all-borders step overwrites the edge lines with the lighter style.
Shared edges
Two neighboring cells share one edge. If cell A1 has a right border and B1 has a left border with a different style, only one line is drawn, and the result can be hard to predict. When a border looks wrong, select both cells, choose Clear borders, and apply the border again in one step.
Borders and gridlines
Gridlines are the faint lines Sheets draws around every cell by default. They are a view setting, not a border. Hiding them under View > Show > Gridlines removes them from the screen but does not delete any border you applied. A border is part of the cell's format and stays visible with gridlines off. Many finished reports hide gridlines and use a few deliberate borders instead.
Gridlines also behave differently when you print. By default they do not print, so a sheet that looks boxed in on screen can print with no lines at all. Borders print. If you need lines on paper, apply real borders.
Applying fill colors
Select a range and open the Fill color button, which shows a paint bucket. Pick a swatch, or choose Custom to enter a hex value such as #fff2cc. Choose Reset to remove the fill.
A few practical points:
- Fill color is separate from text color. The paint bucket sets the cell background. The letter "A" button sets the text.
- Colors you add as custom colors appear in a recent list, so you can reuse them. Reusing a small set keeps a sheet consistent.
- A fill covers the whole cell, even when text overflows into the next cell. The overflowing text is drawn over the neighboring cell's background, which can look odd if the two cells have different fills.
Choosing colors that stay readable
Dark text on a light fill is the safest pairing. Pale tints such as light yellow, light green, and light blue keep black text legible. A saturated fill like red or dark blue needs white text. Check contrast on a printed copy too, since many printers render light fills faintly.
Do not use color as the only carrier of meaning. About one in twelve men has some form of color vision deficiency, and a printout in grayscale loses hue entirely. Pair a color with a label, such as a "Status" column that says "Late", so the information survives without the color.
Copying formats without copying values
You often want to reuse a look. The Paint format button, the paint roller in the toolbar, copies the formatting of the selected cell onto another range. Click the source cell, click Paint format, then select the target. Double-clicking the button keeps it active so you can paint several targets in a row. Press Esc to stop.
Paint format copies all formatting, including number format, font, alignment, borders, and fill. If you want only the format and not the values, the same effect is available through Edit > Paste special > Format only, which the earlier chapter on paste special covers. To remove everything at once, select the range and choose Format > Clear formatting (shortcut Ctrl+\ on Windows and ChromeOS, Cmd+\ on Mac).
Alternating colors
Alternating colors, often called banding, shades every other row so the eye can follow a line across a wide table. It is a built-in feature, and it is easier to maintain than coloring rows by hand.
To add it:
- Select the range, or a single cell inside your table.
- Choose Format > Alternating colors.
- In the side panel, pick a style from Default styles, or set your own colors.
- Tick or untick Header and Footer to give those rows their own color.
- Choose Done.
The side panel also lets you edit the range that the pattern covers. Use this when the table grows: change the range from A1:F20 to A1:F40, and the banding extends to match. If you insert a row in the middle of the range, the banding adjusts automatically, and the stripes stay evenly alternating. Manual fills would not do that. You would have to recolor the rows below the insertion.
Alternating colors sit underneath your own formatting. If you apply a manual fill to a cell inside a banded range, the manual fill wins for that cell. To see the band again, reset that cell's fill. To remove banding entirely, select a cell in the range, reopen Format > Alternating colors, and choose Remove alternating colors.
Banding and filters
Banding is tied to row position in the range, not to the data. When you sort, the stripes stay fixed and the data moves through them, so the table still looks evenly striped. When you filter or hide rows, the stripes continue to count hidden rows, so two visible rows in a row can end up with the same color. If that bothers you, use a conditional formatting rule built on a formula instead. It can count only visible rows with SUBTOTAL, which a later chapter on conditional formatting introduces.
Common errors
- A fill seems to disappear. A conditional formatting rule can override a manual fill. Check Format > Conditional formatting for rules on that range.
- Borders vanish after pasting. A normal paste brings the source cell's formatting with it, including its borders and fills. If the source had none, the target's borders are replaced. Use Paste special > Values only to keep the target's existing look.
- The table looks boxed in but prints without lines. You were seeing gridlines. Add real borders.
- Banding covers too much or too little. The range in the Alternating colors panel is fixed until you edit it. Open the panel and adjust it.
- Colors differ between sheets. Swatches were picked by eye. Use custom hex values and write them down, so the same color is reproduced exactly.
Exercise
You have a table in A1:E30 with a header row. You applied outer borders and a light gray fill to the header by hand. Rows are added to the bottom often, and you want every other row shaded without recoloring rows each time. Which feature do you use, which setting do you adjust when the table grows, and what happens if you manually fill one cell inside the banded range?
Show answer
Use Format > Alternating colors, with Header ticked so the header row gets its own color. When the table grows, edit the range in the side panel (for example from A1:E30 to A1:E50). A manual fill on a single cell overrides the banding for that cell only. Resetting that cell's fill brings the band color back.
Exercise
A colleague says they colored overdue invoices red and asks you to total the amounts of the red rows with a formula. Why does that not work, and what should they do instead?
Show answer
Formulas read cell values, not formatting, so color cannot be counted or summed. They should add a Status column (for example "Overdue") or a due-date comparison, total with a formula that uses that column, and optionally color the rows with a conditional formatting rule based on the same value.