Sub topic 15
Cell styles and reusable templates
This chapter assumes you can apply number formats and font colors by hand, and that you know the color-coding convention from earlier in the tutorial (inputs, formulas, links). It shows how to turn those choices into named cell styles and a template file, so you don't rebuild them in every model.
Why direct formatting does not scale
Formatting cells one at a time, with the Format Painter or Ctrl+1, works for a single sheet. In a model with many sheets and a few thousand cells, it causes three problems:
- A convention change, such as moving inputs from blue text to blue text on a pale yellow fill, means finding and repainting every input cell.
- Two analysts on the same file end up with slightly different blues and slightly different decimal places.
- Nothing in the workbook records what a cell is meant to be. A blue number could be an input or a leftover from someone's earlier edit.
A cell style is a named bundle of formatting: number format, font, border, fill, alignment, and protection. Cells that use the style stay linked to it. Edit the style once and every cell that uses it updates.
What a style contains
When you create or modify a style, a checkbox list shows which attributes the style controls. Only checked attributes are applied. Unchecking an attribute lets a style leave that attribute alone. For example, a "Pct_Input" style can control number format and font color, and leave the fill unchanged.
Excel ships with built-in styles that map loosely onto modeling roles:
| Built-in style | Modeling role | Notes |
|---|---|---|
| Input | Hard-coded assumption | Default look is orange text on a tan fill, so most teams redefine it |
| Calculation | Formula | Bold orange text by default, usually redefined |
| Linked Cell | Link to another sheet | Green text by default, which matches the common convention |
| Check Cell | Model check | Pairs well with the check formats from a later chapter |
| Note | Comment or source remark | Useful beside hard-coded data |
You can use the built-ins as they are, but most teams redefine them or add their own, because the defaults do not match finance conventions.
Building a style set
Create a style by formatting one cell the way you want, then choosing Home > Cell Styles > New Cell Style. Name it and confirm the attributes. The keyboard route to the gallery is Alt+H, J.
Use a prefix in every name so related styles sort together in the gallery. A workable set looks like this:
| Style name | Font color | Fill | Number format |
|---|---|---|---|
| In_Number | Blue | Pale yellow | `#,##0_);(#,##0);"-"_)` |
| In_Pct | Blue | Pale yellow | `0.0%_);(0.0%);"-"_)` |
| Calc_Number | Black | None | `#,##0_);(#,##0);"-"_)` |
| Calc_Pct | Black | None | `0.0%_);(0.0%);"-"_)` |
| Calc_Multiple | Black | None | `0.0"x"_)` |
| Link_Number | Green | None | `#,##0_);(#,##0);"-"_)` |
| Hdr_Period | Black, bold | None | `mmm-yy` |
Do not make a separate style for every combination you can imagine. A style per role (input, calculation, link) crossed with a style per unit (number, percent, multiple, date) is enough. Past that, the gallery becomes hard to scan and people go back to painting cells by hand.
Here are the number formats the styles above rely on, written out so you can paste them into the style dialog:
#,##0_);(#,##0);"-"_)0.0"x"_)Applying styles quickly
Select the cells and click the style in the gallery. Applying a style replaces the attributes it controls and keeps the rest. If you then format a styled cell by hand, that cell holds an override, and later edits to the style will not change the overridden attribute.
Two habits keep this manageable:
- Apply styles to whole blocks, such as an entire input column or a full forecast row, instead of single cells.
- Do not use Clear Formats on a styled range if you only want to remove an override. It resets the cells to Normal. Reapply the style instead.
You can also pin the Cell Styles command to the Quick Access Toolbar, which is covered in the last chapter.
Changing a convention once
Suppose your team decides that links to other workbooks should be red, not green. Right-click the style in the gallery, choose Modify, change the font color, and confirm. Every cell using that style changes at once. This is the main reason to prefer styles over the Format Painter.
Carrying styles between workbooks
Styles live inside a workbook. To bring your set into another file:
- Open both workbooks.
- In the destination workbook, choose Cell Styles > Merge Styles.
- Pick the source workbook and confirm.
If the destination already has a style with the same name, Excel asks whether to overwrite it. Answer carefully. Overwriting changes how existing cells in the destination look.
Styles can pile up. Copying sheets between workbooks from many sources imports each source's custom styles, and old files can end up with hundreds of unused ones. This slows file opening, and the gallery becomes cluttered. Delete unused custom styles from the gallery, or build your final model from a clean template rather than from an old file.
From style set to template
Styles solve formatting. A template solves the whole starting point of a model. A template is a workbook saved as .xltx, or .xltm if it has macros. Choosing File > New and picking it creates a fresh, unsaved copy, so the original is never overwritten.
A useful modeling template holds:
- The custom style set from the previous section.
- View settings: gridlines off, zoom level, and freeze panes on the timeline header.
- The sheet layout, such as Inputs, Calculations, Financial Statements, and Checks, with consistent column positions for each time period.
- The period header row, formatted with
mmm-yyor"FY"yyyy. - A
Circ_Switchinput cell and a master check cell, as set up in the earlier chapters. - Print setup, with page orientation, print area, and repeating header rows.
Save it with File > Save As, choosing Excel Template. Excel suggests its default templates folder, and files saved there appear under File > New > Personal. A shared network folder works for teams, as long as you control who can edit it.
How the pieces fit
A template only affects files created after you change it. Models already in progress keep the styles they were born with. Use Merge Styles when you want to update an existing model.
Common errors
- Defining styles but leaving the cells hand-formatted, so changing the style does nothing.
- Using the Normal style as an input style. Normal is the default for every cell, so changing it changes the whole workbook.
- Forgetting that a style's number format only changes display. A percentage style applied to a cell holding 5 shows 500.0%, and the stored value is still 5.
- Saving the template as a normal
.xlsxand then working in it directly, which overwrites your starting point.
Exercise
You change the font color of the Link_Number style from green to red, but a few linked cells stay green. Give two likely causes.
Show answer
Those cells were hand-formatted with a font color after the style was applied, so they hold an override that the style no longer controls. Or they never used the style and were only painted green with the Format Painter. Reapply Link_Number to them and the new color will appear.
Exercise
A colleague opens your template, builds a model, and saves it. A week later you add a new style to the template. Does their model get it automatically? How would you add it?
Show answer
No. A template only affects files created from it after the change. In the colleague's model, open Cell Styles > Merge Styles and select the updated template (or a workbook containing the new style) as the source.