Testing and Documenting Workbook Calculations
A practical guide to checking spreadsheet calculations, testing dynamic-array results, and recording the assumptions and evidence needed for review.
Test calculations and dynamic-array results
Test calculations against known answers
A formula can produce a plausible value and still be wrong. A reliable check is to calculate expected results independently, then compare those answers with the workbook. This can expose incorrect cell references, criteria, or units.
In the example below, Products contains unique SKU codes and unit prices, while Orders contains the SKU, region, and quantity. An exact-match lookup retrieves the price:
=XLOOKUP([@SKU],Products[SKU],Products[UnitPrice],"SKU not found",0)
The final 0 requests an exact match. The explicit not-found message makes a missing product visible instead of silently treating it as free. The order’s line total is quantity multiplied by unit price:
=[@Qty]*[@UnitPrice]
The small test dataset and its independently checkable line totals are shown here.
| SKU | Region | Qty | Expected line total |
|---|---|---|---|
| A10 | East | 2 | $10 |
| A10 | West | 3 | $15 |
| B20 | East | 1 | $12 |
Using those line totals, the East total for A10 should be $10, the total for B20 should be $12, and the East total across both SKUs should be $22. Check each by adding the applicable order lines independently, then compare the results with the workbook.
SUMIFS can calculate a total that meets multiple criteria:
=SUMIFS(Orders[LineTotal],Orders[SKU],A2,Orders[Region],B2)
It adds values that meet all supplied criteria. Its sum range and criteria ranges should have matching dimensions, so the criteria are evaluated against the corresponding rows in the values being summed.
Probe edge cases and formula behavior
Test ordinary cases as well as unusual inputs, following the workbook’s stated business rules. For example:
Missing lookup key: Confirm the documented not-found message appears. Decide whether that record should be excluded from valid sales rather than silently included as a free item.
Zero quantity: Check that the line total is zero, then decide whether such rows remain in reports.
No matching records: Confirm a conditional total returns zero if that is intended, and that a filtered list handles no matches as intended.
Boundary values: Test values exactly at the thresholds, date limits, or minimums and maximums defined by the rules.
Blank or invalid input: Check missing IDs, blank quantities, and text in numeric fields. Also test duplicate product codes, since the workbook’s lookup assumptions and expected handling should be clear.
Dynamic-array formulas need their own checks. =UNIQUE(Orders[Region]) should return the unique regions, and =FILTER(Orders,Orders[Region]="East","No matching orders") should return the East-region rows or the specified message when there are no matches. Check that the is clear, that results change as source rows are added or removed, and that the no-match behavior is deliberate. A blocked can prevent output from appearing.
Investigate formula errors rather than hiding them by default. Excel’s Error Checking and Evaluate Formula tools can help trace a calculation, but an error-free result alone does not prove the business logic is correct.
Document assumptions and test evidence
Document assumptions and test evidence
Documentation lets another person interpret the workbook and reproduce its checks. Keep a concise Read Me or Assumptions sheet that explains what each key output means, including its units and reporting period. State what counts as a valid record and how blanks, duplicates, missing lookups, returns, and zero quantities are treated.
Also record which source tables or ranges feed the calculations, whether lookups require exact matches, whether IDs are expected to be unique, and when the workbook was last checked. These details make the assumptions behind a result explicit rather than leaving a reviewer to infer them from formulas.
For each test, record the case, expected result, actual result, and date tested. That evidence makes it possible for another person to review what was checked and repeat the test during maintenance. Add brief cell notes or comments when a formula’s purpose is not obvious. For formula review, Excel’s FORMULATEXT can display a cell’s formula as text; for example, =FORMULATEXT(C2).
: Testing workbook calculations by comparing formula results with known answers and checking relevant edge cases.