← Emberlern/The Data Diaries With Dee
How to Be a Top-Notch Data Analyst / Module 02

Excel that holds up under pressure

Seven lessons, about an hour and ten minutes. You'll take Sahara Mart's branch spreadsheets — the ones that break every time someone inserts a column — and rebuild the habits that stop that from happening.

Module 2 practice workbook A real Sahara Mart-style export with every problem this module names already baked in — inconsistent branch names, text dates in three formats, a stray TOTAL row, and a Products tab built to break a lazy VLOOKUP. Build the Table, the lookups, the SUMIFS and the pivot yourself, then check against the worked example tab. One .xlsx, five tabs.
Lesson 2.111 minutes

Structuring a sheet so formulas don't break when data grows

Every branch manager at Sahara Mart keeps a version of the same spreadsheet, and every version breaks the same way. Someone inserts a row for a new product halfway down the list, and a SUM formula three rows above quietly stops including it. Nobody notices for two weeks, because the number still looks plausible — it's just wrong.

This happens because the sheet was built around ranges typed by hand — =SUM(B2:B47) — rather than around a structure that grows with the data. The fix is not a cleverer formula. It's building the sheet differently from the start.

Tables, not ranges

Turn any list of rows into an Excel Table (Insert > Table, or Ctrl+T) before you write a single formula against it. A Table gives the range a name, auto-expands when you add a row anywhere inside it — including the bottom — and every formula referencing it grows automatically. =SUM(SalesTable[Revenue]) will always sum every row of that column, whether the table has 40 rows or 4,000.

Before and after, same data
Before=SUM(B2:B47) — stops updating the moment a row is added at row 48 or inserted mid-range in a way that lands outside the hard-coded reference.
After=SUM(SalesTable[Revenue]) — a new row anywhere in the table, including a paste of 200 new rows, is included automatically.

A named Table is not a formatting choice. It is the single change that prevents the most common silent error in branch reporting.

One row, one transaction — never a summary row mixed into the data

The second recurring fault in Sahara Mart's sheets: someone adds a "TOTAL" row at the bottom of the same table that holds the daily transactions. The moment that happens, any SUM or AVERAGE run over the whole table double-counts, because the total row is itself being summed. Keep raw data and summaries on separate sheets, always. The raw data sheet should contain nothing but rows of the same shape, one per transaction or one per day — no headers halfway down, no blank separator rows, no totals mixed in.

Why this is worth doing on day one, not "eventually"

Restructuring a live spreadsheet that five people already use is disruptive. Restructuring it before anyone else has built formulas on top of the old, fragile version costs almost nothing. If you inherit a branch's existing sheet, this is the first thing to fix — before you build anything new on top of it.

Keep this
  • Convert any list to a Table (Ctrl+T) before writing formulas against it — ranges grow automatically, hard-coded cell ranges don't.
  • Never mix a summary or total row into the same range as the raw data it's summarising.
  • Fix the structure before you build on top of it, not after.
Lesson 2.211 minutes

Lookups that survive an inserted column

Sahara Mart's product list lives in one sheet; each branch's daily sales live in another, referencing products by SKU code. Somewhere, someone needs to look up a product's category or price from its SKU. This is the single most common operation in the whole course, and the most common way to quietly break a workbook.

Why VLOOKUP is the wrong default

=VLOOKUP(A2, Products!A:D, 3, FALSE) works — until someone inserts a new column into the Products sheet between columns A and D. The "3" was counting columns from the left edge of the range, and that count is now wrong, silently returning the wrong value rather than an error. This is worse than a formula that breaks loudly, because nobody notices.

The fix: XLOOKUP

=XLOOKUP(A2, Products!A:A, Products!D:D)

This names the lookup column and the return column directly, by reference, not by counting position. Insert a column anywhere in the Products sheet and this formula keeps pointing at the right data, because it never counted columns in the first place.

Where XLOOKUP isn't available (some older Excel builds still in use at Sahara Mart's branch offices), INDEX/MATCH does the same job: =INDEX(Products!D:D, MATCH(A2, Products!A:A, 0)). Slightly more to type, same immunity to inserted columns.

Handling the "not found" case honestly

A lookup for a SKU that doesn't exist in the Products sheet — a typo, a discontinued item still showing in old sales data — returns #N/A by default. Wrapping it in IFERROR to hide that error is tempting and usually wrong: it silently converts a real data problem into a blank cell that looks like a legitimate zero. Better: =IFERROR(XLOOKUP(...), "CHECK SKU") — something visible enough that it gets caught in review, not something that disappears into the summary numbers unnoticed.

Keep this
  • Use XLOOKUP (or INDEX/MATCH) by default — never VLOOKUP counting columns by position.
  • Don't silently hide lookup errors with IFERROR-to-blank. Make missing data visible, not invisible.
Lesson 2.311 minutes

Conditional aggregation: SUMIFS, COUNTIFS, and multi-criteria logic

"What was Lekki branch's revenue from the beverages category last Tuesday" is a question with three conditions stacked on top of each other — branch, category, date. This is exactly what SUMIFS is built for, and it is the formula you will reach for more than any other in this course.

SUMIFS, worked

=SUMIFS(SalesTable[Revenue], SalesTable[Branch], "Lekki", SalesTable[Category], "Beverages", SalesTable[Date], DATE(2026,8,25))

Read it right to left in groups of three: the column to sum, then pairs of (condition column, condition value) repeated for as many criteria as you need. All conditions must be true for a row to be included — this is an AND, not an OR.

COUNTIFS works identically but counts matching rows instead of summing a column — useful for "how many transactions" rather than "how much revenue." AVERAGEIFS does the same for averages. All three share the exact same argument pattern, so learning SUMIFS well teaches you the other two for free.

The trap: an OR condition dressed up as if it were an AND

"Revenue from Lekki or Yaba branches" is not a job for a single SUMIFS with a branch condition — SUMIFS can't express OR inside one condition slot directly. The reliable pattern is to sum two SUMIFS calls: =SUMIFS(...,"Lekki",...) + SUMIFS(...,"Yaba",...). New analysts often try to jam both branch names into one condition and get a silent zero or an error, because SUMIFS is quietly expecting a single exact match per criteria pair, not a list.

Wildcard care

SUMIFS supports wildcards — "Lek*" matches anything starting with "Lek". Useful, but dangerous if a product or branch name genuinely contains an asterisk or question mark, which needs escaping with a tilde. Rare at Sahara Mart, but worth knowing before it silently breaks a total.

Keep this
  • SUMIFS/COUNTIFS/AVERAGEIFS share one pattern: sum column, then (condition column, value) pairs, all joined as AND.
  • To express OR across values in the same field, add separate SUMIFS calls together rather than forcing a list into one condition.
Lesson 2.410 minutes

Pivot tables aimed at a question, not at the data

The fastest way to build a useless pivot table is to drag every field you have into it "to see what's there." A pivot table should exist because you already have a question — module 1's discipline applies here directly — and its shape follows from that question, not the other way round.

Start from the question, not the field list

Chidi asks: "which branches are dragging down this month's average basket size?" That question names exactly what belongs where: Branch in Rows, Average of Basket Size in Values, month filtered in the filter area. Nothing else. A pivot with Branch, Category, Day of Week, Payment Method and three value fields all dropped in at once might technically contain the answer somewhere inside it, but it takes Chidi longer to find it than it would take him to ask you directly — which defeats the purpose of building it at all.

Two pivots, same data, one question each
Everything pivotBranch × Category × Week in rows, Revenue / Units / Basket Size / Discount all in values. Technically complete, practically unreadable in one glance.
Question pivotBranch in rows, Average Basket Size in values, this month only. Answers exactly what was asked, readable in three seconds.

If a second question comes up, build a second pivot. Pivot tables are cheap to create and nearly free to delete — there's no cost to having several small, sharp ones instead of one sprawling one.

Keep this
  • Know the question before you open the pivot table field list, and let the question decide what goes where.
  • Prefer several small, single-purpose pivots over one pivot trying to answer everything at once.
Lesson 2.511 minutes

Power Query: an import that cleans itself every time

Every Monday, each of Sahara Mart's nine branches exports last week's till data as a CSV and emails it in. Every one of those nine CSVs is formatted slightly differently — one branch's till software puts the date as DD/MM/YYYY, another as text, a third leaves trailing spaces on every branch name. Manually cleaning nine files every week is not a sustainable habit; it is a guaranteed future mistake waiting for a busy Monday.

Build the cleaning step once, in Power Query

Power Query (Data > Get Data > From File) lets you record a sequence of cleaning steps — trim whitespace, fix the date column's type, rename columns to match your standard, filter out any test transactions — once, against one sample file. Every subsequent week, you point the same query at the new file and click Refresh; every step replays automatically, in order, on the new data.

A minimal cleaning sequence for a branch export
  1. Remove any fully blank rows at the top or bottom of the export.
  2. Trim whitespace from the Branch and Category text columns.
  3. Set the Date column's type explicitly, rather than trusting Excel's auto-detect, which behaves differently across the nine branches' export formats.
  4. Filter out rows where Transaction Type equals "VOID" or "TEST" — till software leaves these in the export.
  5. Rename columns to Sahara Mart's standard names, since branch till software labels them inconsistently.

The point of Power Query is not that it's faster once. It's that it's identical every single time, which a person redoing the same five steps by hand every Monday morning at 8am, tired, will not be.

What to do when a branch changes its export format

It will happen — a branch upgrades its till system and the CSV columns shift order. The query will error loudly on Refresh rather than silently producing wrong numbers, which is exactly the outcome you want: a loud failure that gets fixed once, not a quiet one that pollutes a month of reports before anyone notices.

Keep this
  • Any cleaning step you do more than once by hand belongs in Power Query instead, recorded once and replayed on every refresh.
  • A loud error on Refresh, when a source format changes, is a feature — it stops bad data before it reaches a report.
Lesson 2.68 minutes

Error handling, validation, and leaving an audit trail

A workbook that never shows an error is not necessarily a correct workbook — it might just be one where errors have been hidden rather than fixed. Two habits keep this from happening at Sahara Mart.

Data validation stops bad input at the source

Any cell a human types into directly — a branch manager entering a manual adjustment, say — should have Data Validation restricting what can go in it: a dropdown list of the nine valid branch names, rather than free text that will inevitably drift into "Lekki", "lekki", and "Lekki Branch" as three different values that don't group together in any pivot table.

An audit trail: who changed what, and why

When a number is adjusted manually — a correction for a till error, say — that adjustment should be visible, not buried inside the original figure. Keep a separate "Adjustments" column or sheet: original value, adjusted value, who made the change, and one line of reasoning. Six months later, when someone asks why April's Yaba figure looks unusual, the answer is one lookup away instead of a mystery.

The habit this replaces

The failure mode this prevents is a branch manager quietly overtyping a wrong number directly in the raw data sheet to "fix" it, with no record that a change was made at all. It might even be the right fix — but nobody downstream can ever verify that, and the original wrong number is now unrecoverable.

Keep this
  • Restrict free-text entry with dropdown validation wherever the valid values are a known, fixed list.
  • Never overtype a raw figure to correct it — log the correction separately, with who and why.
Lesson 2.78 minutes

Handing a workbook to someone who didn't build it

A workbook only you can operate is a workbook that breaks the moment you're on leave. Chidi needs to be able to open any report you build, understand roughly how it works, and refresh it himself in a pinch — even though he didn't write a single formula in it.

A minimal handover standard

  • A README tab, first in the workbook. Three lines: what this workbook does, where the source data comes from, and what to do if a number looks wrong.
  • Colour-code by function. Blue text for numbers a person can safely type over (inputs); black for formulas nobody should touch. This single convention, used consistently, tells anyone at a glance what's safe to edit.
  • Name the sheets for what they contain, not for how you built them. "Branch Summary" is useful to a stranger; "Sheet3 (working)" is not.

None of this is about making the workbook prettier. It's about making sure the analysis survives contact with someone other than you — including future-you, six months from now, who will have forgotten exactly why a formula was built the way it was.

Keep this
  • A README tab and a consistent colour convention turn a workbook only you understand into one anyone at Sahara Mart can operate.
  • Name sheets for their content, not their build history.
Before the drill

Have Excel or Google Sheets open and ready — the drill below is a real, hands-on file, not a written exercise.

Module 2 drillabout 90 minutes

The 12,000-row sales export

You're handed a raw 12,000-row export covering all nine branches over six weeks — the kind of file this module has been describing the whole way through. Branch names are inconsistently cased ("Lekki", "LEKKI", "Lekki Branch"), dates arrive as text in two different formats depending on which branch's till exported them, and there are a handful of VOID transactions still sitting in the data.

Deliver a workbook containing

  1. A cleaned data table. Branch names standardised to the official nine, dates converted to a real date type, VOID rows removed — built as a Power Query so it can be refreshed against next week's export without redoing this by hand.
  2. A weekly summary pivot. Revenue by branch by week, built from a question ("how is each branch trending week over week"), not a dump of every field.
  3. A lookup-based product detail. Every transaction row showing the product's category, pulled in with XLOOKUP against the Products sheet, in a way that would survive someone inserting a column into Products.
  4. A README tab. What the workbook does, and what to do if a branch name doesn't match the official nine after refresh.

How it's marked

  • Does the cleaning step live in Power Query, or was it done by hand once? A hand-cleaned file fails this drill even if the numbers are currently correct — it won't survive next week's file.
  • Do the lookups use XLOOKUP or INDEX/MATCH, not VLOOKUP counting columns by position?
  • Is the underlying data an Excel Table, not a hard-coded range?
  • Does the pivot answer a specific question cleanly, rather than including every available field?
  • Could Chidi, who didn't build this, open it and understand what he's looking at inside two minutes?
What this drill is really testing

Not whether you know the individual functions — SUMIFS and XLOOKUP are both one search away for anyone. It's testing whether the habits from this module (Tables not ranges, cleaning steps recorded not repeated, lookups that survive change, a stranger-readable handover) show up together, under time pressure, on a genuinely messy file — because that combination is what actually gets asked for at Sahara Mart every single week.

Before module 3

Keep this cleaned workbook — module 3 loads the same underlying sales data into a SQL database, and you'll compare what a spreadsheet does well against what a database does better once the row count keeps growing.