Sub topic 13
Auditing an Existing Model's Formatting
Assume you already know cell references, formulas, basic financial statements, and the difference between historical and forecast periods. This chapter shows how to inspect an existing workbook for formatting inconsistencies. The goal is to find issues that can hide errors or slow review.
Start with the model's stated rules
Before changing cells, look for a cover sheet, legend, notes, or house-style guide. Do not assume that blue always means an input or that negative numbers always use parentheses. Those conventions are common, but each model may define them differently.
Record the rules in a small audit table:
| Area | Expected rule | Example issue |
|---|---|---|
| Hardcodes | Blue font and yellow fill | A growth assumption is black |
| Formulas | Black font | A formula is blue and looks editable |
| Cross-sheet links | Green font | A linked value appears to be a hardcode |
| Costs | Negative values | One expense is entered as a positive |
| Units | Clearly stated | Revenue is shown without indicating millions |
| Checks | Visible and zero when passing | A failed balance check is hidden |
A formatting audit should identify exceptions, not redesign the workbook. Preserve intentional differences, such as a warning cell or a historical-data import area, when the legend explains them.
Follow a repeatable audit sequence
Use this order:
- Confirm the workbook's structure. Identify input sheets, calculation sheets, output sheets, and summary pages.
- Inspect timeline headers. Check that dates are ordered and that actual and forecast periods are clearly marked.
- Review labels and units. Every important row should say what it measures, and the scale should be visible.
- Review font colours. Compare hardcoded values, formulas, same-sheet links, and cross-sheet links with the documented scheme.
- Review fills. Inputs, headers, and checks should be easy to find without making the entire workbook colourful.
- Review number formats. Check percentages, multiples, currencies, negatives, zeros, and decimal precision.
- Trace check cells. A balance check should return zero when the model balances and should be visible when it fails.
- Sample formulas. A cell with an unexpected colour may reveal a pasted value, a broken link, or a formula overwritten by a hardcode.
The following flow shows the decision path for one cell:
Use a tool to find obvious exceptions
A spreadsheet tool can locate style problems faster than manual inspection. The script below checks non-empty cells in an .xlsx workbook. It reports numeric hardcodes that are not blue, formulas that do not use the expected black or green font, and numeric cells with a general number format.
from pathlib import Path
import sys
from openpyxl import load_workbook
def rgb(cell):
color = cell.font.color
if color is None:
return None
if color.type == "rgb":
return color.rgb[-6:].upper()
return color.type
def audit(path):
workbook = load_workbook(path, data_only=False)
for sheet in workbook.worksheets:
print(f"\n[{sheet.title}]")
for row in sheet.iter_rows():
for cell in row:
if cell.value is None:
continue
colour = rgb(cell)
value = str(cell.value)
is_formula = value.startswith("=")
is_external = is_formula and "[" in value
expected = {"0000FF"} if not is_formula else (
{"008000", "00B050"} if is_external else {"000000"}
)
if is_formula and colour not in expected:
print(
f"{cell.coordinate}: formula colour {colour}; "
f"expected one of {sorted(expected)}"
)
elif isinstance(cell.value, (int, float)) and not is_formula:
if colour not in {"0000FF", "0000FF00"}:
print(
f"{cell.coordinate}: hardcode colour {colour}; "
"expected blue"
)
if isinstance(cell.value, (int, float)):
if cell.number_format == "General":
print(
f"{cell.coordinate}: numeric value uses General format"
)
if __name__ == "__main__":
if len(sys.argv) != 2:
raise SystemExit("Usage: python audit_model.py model.xlsx")
filename = Path(sys.argv[1])
if not filename.exists():
raise SystemExit(f"File not found: {filename}")
audit(filename)This is a screening tool, not a complete validator. Excel colours may be stored as theme or indexed colours, and a workbook may intentionally use a different palette. Update the expected colour codes to match the model's legend. Also inspect formulas for sign errors, because formatting alone cannot prove that a cost or cash flow has the correct sign.
Common audit findings
The most useful findings usually indicate how a model was edited:
- A blue formula may have been copied from an input area or may replace a hardcoded value.
- A black hardcode may be an imported historical figure or an accidental overwrite.
- A positive cost in a model using negative costs can distort subtotals.
- A percentage displayed as
8.0instead of8.0%can create a tenfold assumption error. - A zero shown as
0may be harder to scan than a dash, especially in long statements. - A failed check with the same fill as ordinary cells can remain unnoticed.
Record each exception with its sheet, cell address, observed style, expected style, and reason for the decision.
Exercise
A forecast cell contains =Revenue*(1+Growth), but its font is blue. The legend says blue means hardcoded input and black means formula. What should you do first?
Show answer
Inspect whether the formula was intentionally placed in an input area. If not, change the font to the documented formula colour and check nearby cells for other overwritten or incorrectly formatted formulas.