Chapter 4: Excel Essentials for Accounting Analytics

Accounting Analytics: An Integrated Approach

In this chapter

Part II of V: Accounting Analytics with Excel

Chapter 1 of 5 in this Part

  • 4.1 Why Workbook Structure Matters
  • 4.2 Excel Tables and Structured References
  • 4.3 Bringing Data into the Workbook with Power Query
  • Guided Tutorial 4.1
  • 4.5 Cell References and Named Cells
  • Guided Tutorial 4.2
  • 4.7 Sorting, Filtering, and Slicers
  • 4.8 Conditional Formatting
  • 4.9 Data Validation
  • 4.10 Organizing and Documenting the Workbook
  • Guided Tutorial 4.3
  • 4.12 Looking Ahead

Learning objectives

  1. Explain why the structure of a workbook is a control over the accuracy of an analysis, drawing on research into spreadsheet errors.
  2. Build an analysis workbook by importing Excel Tables with Power Query, and use structured references and calculated columns in formulas that are easier to read and maintain than cell addresses.
  3. Distinguish between relative, absolute, and mixed cell references, apply each correctly, and use named cells to hold the parameters of an analysis.

Learning objectives (continued)

  1. Apply multi-level sorts, filters, slicers, and the SUBTOTAL function to explore transaction-level data and summarize only the records in view.
  2. Use conditional formatting to surface patterns and exceptions, and data validation to protect the cells that drive an analysis.
  3. Organize and document an analytical workbook so that a reviewer can follow every number back to its source.

Build it to hand to someone else

  • The controller has read your data readiness memo from Part I and wants the diagnostic answer
  • Why did Furniture gross margin fall from the third quarter to the fourth?
  • The finance team, and possibly the auditors, will review the analysis
  • So the workbook must refresh, never alter the company’s data, and lead a reviewer from any number to its source

4.1 Why Workbook Structure Matters

Spreadsheet errors are common; checks are informal

  • Panko: errors occur in a few percent of all cells, so a large workbook almost surely holds some
  • Powell et al.: error rates vary widely, and many errors change nothing, but one changed a result by over $100 million
  • Caulkins et al.: managers call errors common, and quality control is mostly informal
  • Church et al.: smaller companies still do their leading accounting tasks in Excel

Structure is a control, not a guarantee

  • A 2008 review found little known about how errors arise or how to avoid them (Powell et al.)
  • A structured design approach cut errors in the links between parts of a workbook (Janvrin and Morrison)
  • Tables, named parameters, validation and documentation remove common chances for error
  • They also leave the logic visible to the person who checks it

4.2 Excel Tables and Structured References

An Excel Table manages its data as one named object

  • It knows where its data begins and ends, and which row holds the headers
  • It adds filter buttons and banding, and grows when you add rows
  • Every worksheet of CharlesRiver.xlsx already stores its data as a Table
  • So Data > Filter turns their filter buttons off rather than on

A plain range depends on cell addresses

Detail of the plain-range view of four invoice lines, one of them shaded, in columns A, G, H, K and P, with ordinary text in row 1. Notes below the cells explain that the ListAmount formula was typed in the first row and copied down by hand, so each row holds its own copy, and that the total names fixed cells, so rows added below the data are left out without a warning.
Figure 4.1 · A Plain Range Compared with an Excel Table (detail)

A Table knows its extent and names its columns

Detail of the same four invoice lines as the SalesInvoiceLine Excel Table, with its name, a header row with filter buttons, banded rows and ListAmount as a calculated column. Notes below the cells explain that one formula fills every row, including rows added later, and that the total refers to the LineTotal column by name, so it includes every row the Table holds. A last note says the shaded row is the Alder Desk line traced in Tutorial 3.2.
Figure 4.1 · A Plain Range Compared with an Excel Table (detail)

Structured references state their own logic

  • SalesInvoiceLine[LineTotal] is the whole column, however many rows it holds
  • [@Quantity] is the value in the current row
  • Click a Table cell while writing a formula, and Excel inserts the reference
  • By default, a formula typed in an empty column becomes a calculated column

Watch out: a Table grows when you type next to it

  • A value typed in the row below a Table becomes a new row
  • One typed in the column to its right becomes a new column
  • So a summary typed beside a Table ends up inside it
  • Keep summaries, parameters and notes on their own worksheets

4.3 Bringing Data into the Workbook with Power Query

Power Query brings data in without changing it

  • Working in the company workbook alters its data, carries far more than needed, and records no steps
  • Power Query connects to the source, and its editor shapes the data
  • Each filter, removed column or type change is recorded under Applied Steps
  • The result loads as a Table, and Data > Refresh All repeats every step

Check the types Power Query chose

  • By default, Power Query types each column from its first 200 rows, in a step named Changed Type
  • The first invoice lines carry no promotion, so Discount can arrive as a whole number
  • A whole-number Discount rounds every rate to zero
  • Fix it with Replace current, which corrects Changed Type before any rounding

Guided Tutorial 4.1: Building the Furniture Analysis Workbook with Power Query

Steps 1 to 6: connect and shape the queries

  1. Create the analysis workbook
  2. Connect to CharlesRiver.xlsx and choose the Tables
  3. Rename the queries
  4. Keep only the items Charles River sells
  5. Keep only the columns the analysis needs
  6. Check the data types

Choose the Tables, then Transform Data

A mock of the Power Query Navigator for CharlesRiver.xlsx. The Select multiple items check box is checked. The list shows worksheets, such as SalesInvoiceLine, with a worksheet icon, and below them four checked Excel Tables with a table icon: T16_SalesInvoice, T17_SalesInvoiceLine, T44_Item, and T7_PromotionProgram. T17_SalesInvoiceLine is selected, and the preview pane shows its first rows. The check box and the Transform Data button are outlined.
Figure 4.2 · The Power Query Navigator for CharlesRiver.xlsx

Applied Steps record how the data was prepared

A mock of the Power Query Editor. The Queries pane lists SalesInvoice, SalesInvoiceLine, Item, and PromotionProgram, with Item selected. The preview shows the first items that have a list price, with the columns ItemID, ItemName, ItemGroup, and ListPrice, and the filtered ListPrice column is outlined. The Applied Steps list reads Source, Navigation, Changed Type, Filtered Rows, and Removed Other Columns, with the last two outlined, and the status bar shows how many columns and rows remain.
Figure 4.3 · The Item Query in the Power Query Editor

Steps 7 to 11: load, extend and check the import

  1. Load the queries into the workbook
  2. Check the Table name
  3. Add two calculated columns
  4. Build control totals to check the import
  5. Test the refresh

Two calculated columns extend the invoice lines

A mock of the SalesInvoiceLine Table after Tutorial 4.1, with columns B through F and L through O hidden. The Table Name box on the Table Design tab reads SalesInvoiceLine, and the formula bar shows =ROUND([@Quantity]*[@BaseListPrice],2) for the selected ListAmount cell. Of five consecutive invoice lines, two carry a promotional discount of 0.1 and have a DiscountAmount greater than zero, and the other three have a DiscountAmount of zero. The ListAmount and DiscountAmount calculated columns are outlined.
Figure 4.4 · The SalesInvoiceLine Table with Its Calculated Columns

Checkpoint

Your workbook should now contain four data worksheets, each holding a Table named after its query, and an Analysis worksheet. Check that:

  • the Item Table holds only the items Charles River sells;
  • the line total and the invoice subtotal agree exactly, and the difference is zero;
  • the list amount is well above the line total;
  • the discount taken is a small fraction of the line total, but not zero.

4.5 Cell References and Named Cells

References change differently when copied

Three panels. The relative panel shows =B2*C2 in D2 becoming =B3*C3 when copied down one row. The absolute panel shows =B2/$B$6 becoming =B3/$B$6, so every row divides by the same total in B6. The mixed panel shows a two-way grid in which =$A3*(1-B$2) becomes =$A3*(1-C$2) when copied one column to the right and =$A4*(1-B$2) when copied one row down, because the column of the row labels and the row of the column headers are locked.
Figure 4.5 · How Cell References Behave When a Formula Is Copied

Check your understanding

Copy each reference one row down and one column right. What does it become?

  1. A2
  2. $A$2
  3. $A2
  4. A$2

A dollar sign locks what follows it

  1. B3: both parts adjust
  2. $A$2: nothing changes
  3. $A3: the column stays, the row adjusts
  4. B$2: the row stays, the column adjusts

Watch out: filling across shifts structured references

  • Filling down leaves a structured reference unchanged
  • Filling across moves it to the next column of the Table, with no error
  • Copy and paste instead, or lock the column: [[PricingMethod]:[PricingMethod]]
  • Then read the formula bar of a cell in the middle of the result

Named cells hold the parameters of an analysis

  • Name a cell in the Name Box, such as LargeLineThreshold
  • A name made this way is an absolute reference, and the formula states its logic
  • Keep every parameter on one worksheet, with a name and a description
  • The Name Manager lists every name, and every Table, with its value and cell

Guided Tutorial 4.2: Parameters, Named Cells, and a Summary Grid

Build the parameters and the grid in seven steps

  1. Create the parameters worksheet
  2. Derive the large-line threshold from the data
  3. Count the large lines and measure their share
  4. Lay out the grid
  5. Fill the grid with one formula
  6. Add the totals
  7. Convert the counts into shares of all lines

The Analysis worksheet after Tutorial 4.2

A mock of the Analysis worksheet. Rows 3 to 9 hold the control totals, in which the line total and the invoice subtotal agree and the difference is zero. Rows 11 and 12 give the number of large lines and their share of the line total. Rows 15 to 20 hold the grid of invoice lines by pricing method and discount rate, with totals, outlined, and rows 22 to 26 show the same counts as shares of all lines. The Base List row has no discounted lines. Cell E19 is selected, and the formula bar shows =COUNTIFS(SalesInvoiceLine[PricingMethod],$A19,SalesInvoiceLine[Discount],E$15).
Figure 4.6 · The Analysis Worksheet with the Control Totals and the Summary Grid

A promotion is a discount on top of a price

Detail of the Analysis worksheet: the outlined grid that counts the invoice lines by pricing method and discount rate, with row and column totals, and below it the same counts as shares of all lines. Most lines are Segment Price List lines with no discount, and the Base List row has no discounted lines.
Figure 4.6 · The Analysis Worksheet with the Control Totals and the Summary Grid (detail)

Checkpoint

Before moving on, check that:

  • the grand total of the grid equals the number of invoice lines;
  • the share block adds up to 100 percent, which =SUM(B23:E26) confirms, because the rounded percentages on display can add up to slightly more.

4.7 Sorting, Filtering, and Slicers

Sort on several levels and filter on conditions

  • Data > Sort adds levels: the first sets the order, later ones break ties
  • Number, text and date filters select by condition, not only by value
  • Filters on different columns combine, and the status bar counts the rows in view
  • Relative date filters count from today, so filter historical data by explicit dates

SUBTOTAL and slicers work on the rows in view

  • A filter hides rows, but SUM still totals every row of the Table
  • SUBTOTAL(109, …) sums the visible rows, and SUBTOTAL(103, …) counts them
  • A slicer is a panel of buttons, one per value, that filters a Table
  • It shows which filter is active, and Clear Filter brings every row back

Check your understanding

A slicer shows one promotion’s lines. What does each formula return?

  1. =SUM(SalesInvoiceLine[DiscountAmount])
  2. =SUBTOTAL(109,SalesInvoiceLine[DiscountAmount])
  3. =SUBTOTAL(103,SalesInvoiceLine[SalesInvoiceLineID])
  4. =SUBTOTAL(9,SalesInvoiceLine[DiscountAmount]), after you hide some of those lines by hand

SUM sees every row; SUBTOTAL sees the view

  1. The discount on every line, in view or not
  2. The discount on the promotion’s lines in view
  3. The number of the promotion’s lines in view
  4. The promotion’s discount, still counting the lines hidden by hand

4.8 Conditional Formatting

Conditional formatting directs attention

Table 4.3 · Types of conditional formatting rules

Rule type What it does Accounting example
Highlight Cells Rules Formats cells greater than, less than, between, or equal to a value, or containing given text Highlight invoice lines above a review threshold
Top/Bottom Rules Formats the highest or lowest items by count or percentage, or values above or below the average Highlight the top 10 percent of line amounts
Data Bars Fills each cell with a bar whose length reflects its value Compare discount dollars across promotions in a summary grid

Scales, icons and formula rules show patterns

Table 4.3 · Types of conditional formatting rules

Rule type What it does Accounting example
Color Scales Shades cells along a color gradient from low to high Show the spread of margins across items
Icon Sets Places an icon in each cell according to thresholds Mark variances as favorable, neutral, or unfavorable
Formula-based rules Formats cells for which a formula you write returns TRUE Highlight every row of the invoice lines that carries a promotional discount

A formula rule can shade a whole row

  • Select the Table’s data rows, with the first data cell active
  • Enter a rule such as =$J2>0, where column J holds Discount
  • The dollar sign fixes the column; the row adjusts for every cell
  • Rules use cell references, not structured references

Watch out: color alone is a weak way to report

  • Color-blind readers may miss it, and a printout may lose it
  • A highlighted cell cannot be counted or totaled
  • Use formatting to find the exceptions, then record them in a lasting form
  • A flag column, a COUNTIFS total or a filtered list all survive

4.9 Data Validation

Validation guards the inputs against typing mistakes

  • Data > Data Validation allows a list, a number or date range, a text length or a custom rule
  • The Input Message explains the parameter; a Stop alert refuses an invalid entry
  • Pasted or filled values get no alert, and an ordinary paste replaces the rule
  • Existing values and formula results raise no alert; Circle Invalid Data marks them

4.10 Organizing and Documenting the Workbook

Four layers keep data, inputs, logic and notes apart

A diagram of the four layers of an analysis workbook. On the left, the CharlesRiver.xlsx workbook is the source and is never edited. Power Query reads selected Tables from it, applies recorded steps, and loads the results into data worksheets in the analysis workbook: SalesInvoice, SalesInvoiceLine, Item, and PromotionProgram. Refresh All repeats the queries. A parameters worksheet holds the named input ThresholdPercentile, protected by validation, and the named threshold LargeLineThreshold, which a formula derives from it and the line totals. An analysis worksheet holds formulas that use structured references to the Tables and the named parameters. A documentation worksheet, first in the workbook, records the purpose, source, queries, parameters, preparer, reviewer, and open questions.
Figure 4.7 · Layers of an Analysis Workbook

A documentation worksheet comes first

  • Purpose, source, Tables and query filters, and the date of the last refresh
  • The parameters and what each controls; the worksheets and their contents
  • The preparer and the reviewer, with dates, and any open questions or limitations
  • A formatting convention, such as blue inputs and black formulas

Check your understanding

Which tool does each job?

  1. Shade every invoice line that carries a discount
  2. Refuse an impossible threshold percentile
  3. Let a reviewer see every assumption in one place
  4. Record the source, the steps, the preparer and the reviewer

Each job has its tool

  1. A formula-based conditional formatting rule
  2. Data validation with a Stop alert
  3. Named, validated cells on a parameters worksheet
  4. The documentation worksheet, placed first

Guided Tutorial 4.3: Surfacing Promotions and Documenting the Workbook

Finish the workbook in nine steps

  1. Protect the threshold parameter with data validation
  2. Highlight every line with a promotional discount
  3. Sort the lines so that the promotion lines come together
  4. Add a slicer
  5. Measure the lines in view
  6. Find out what promotion 8 is
  7. Create the documentation worksheet
  8. Record what the workbook contains
  9. Put the workbook in order and refresh it

One promotion stands out in lines and discount

A mock of the SalesInvoiceLine Table filtered by a PromotionID slicer on which button 8 is selected and outlined. The visible rows are sorted by DiscountAmount from largest to smallest, every row is shaded by the conditional formatting rule, and the row numbers are blue because the Table is filtered. The status bar, outlined, reports how many of the Table's records are in view.
Figure 4.8 · The Invoice Lines Filtered to Promotion 8 with a Slicer

The documentation records the clue and the gaps

A mock of the Documentation worksheet, the first of the worksheet tabs. Column A holds the labels Purpose, Source, Query steps, Last refreshed, Parameters, Calculated columns, Worksheets, Conventions, Prepared by, Reviewed by, and Open questions, and column B holds the entries. The open question, outlined, notes that promotion 8, the Furniture Seasonal Promotion, has the most promotion lines and the most discount dollars, and that its effect in each quarter cannot yet be measured.
Figure 4.9 · The Documentation Worksheet of the Analysis Workbook

Checkpoint

Your workbook should now open on a Documentation worksheet that explains it. Check that:

  • every number on the Analysis worksheet traces to a named Table or a named parameter;
  • an out-of-range threshold percentile is refused;
  • the promotion lines are shaded;
  • the slicer shows that promotion 8, the Furniture Seasonal Promotion, has both the most lines and the most discount dollars of any promotion.

4.12 Looking Ahead

Back to the controller’s question

  • The Furniture Seasonal Promotion has the most promotion lines and discount dollars
  • Its dates straddle the end of the third quarter and the start of the fourth
  • A clue, not an answer: the invoice lines carry no invoice date or item group
  • Chapter 5 combines them with the invoices, items and customers into one table

Summary

  • Workbook structure is a control: it removes chances for error and shows the logic
  • Tables stay correct as data grows; Power Query never changes the source
  • Relative, absolute and mixed references decide what a copied formula does
  • Sorts, filters, slicers and SUBTOTAL explore; formatting and validation guard
  • Layers and a documentation worksheet lead a reviewer to every source

Key terms

Absolute reference · Applied steps · Calculated column · Conditional formatting · Control total · Data validation · Documentation worksheet · Excel Table · Mixed reference · Named cell · Parameter cell · Power Query · Relative reference · Slicer · Structured reference · SUBTOTAL function

Practice and next steps

  • Financial Accounting
    • Exercise 4.1: A Billing Schedule by Fiscal Year
    • Exercise 4.2: Reviewing Promotional Discounts
  • Managerial Accounting
    • Exercise 4.3: List-Price Margins by Product Group
    • Exercise 4.4: Freight Billed Versus Freight Incurred
  • Auditing
    • Exercise 4.5: A Refreshable Shipment Exception Report
    • Exercise 4.6: Reviewing Price Override Approvals

Next: Chapter 5: Data Preparation and Cleaning in Excel

About these slides

These slides accompany Accounting Analytics: An Integrated Approach, licensed under CC BY-SA 4.0. Every figure and table comes from the chapter:

https://aa.accountinganalyticshub.com/chapters/04-excel-essentials/chapter.html