Skip to main content

📊 Lesson 7.3: Project — A Data Cleanup & Analysis Workflow

Real data is messy: inconsistent capitals, stray spaces, duplicate rows, dates in three formats, names crammed into one column. Before you can analyze it, you have to clean it. In this project you'll run a complete, repeatable workflow — assess, clean, standardize, analyze — the exact process a data professional follows every day.

📚 What You'll Learn

By the end of this lesson, you will be able to:

  • Assess a dataset and spot what makes it "dirty"
  • Clean it with TRIM, case functions, SUBSTITUTE, SPLIT, and Remove duplicates
  • Standardize the result and prevent future mess with validation
  • Analyze the tidy data with both a pivot table and QUERY
  • Set up a repeatable raw → staging → analysis workflow

⏱️ Estimated Time: 60 minutes

🎯 Project: Take a messy dataset and run it through a full clean-and-analyze pipeline, keeping the raw data intact.

In This Lesson

Assess the Mess

You can't fix what you haven't spotted, so the first step is always to look. Scroll the data, sort a column, and ask: what's inconsistent? Common problems, and how they hurt you:

Dirty patternWhy it breaks things
Extra spaces ("Apple ")Lookups and groupings miss matches
Inconsistent case ("apple", "APPLE")Treated as different values in some contexts
Duplicate rowsInflates totals and counts
Mixed date formats / text datesSorting and date math fail
Combined fields ("Smith, John")Can't group or sort by one part
Numbers stored as textSUM ignores them silently

🧠 Mindset

Cleaning isn't glamorous, but it's where the real reliability comes from — the saying "garbage in, garbage out" is painfully true in spreadsheets. A beautiful pivot table built on dirty data just gives you confident, wrong answers. Respecting the cleanup step is what separates trustworthy analysis from plausible-looking nonsense.

Clean It Up

The golden rule: never clean in place. Keep the raw data on its own tab, untouched, and build cleaned columns on a separate "Staging" tab. That way you can always compare, and you never destroy the original. Your cleaning toolkit (much of it from Lesson 2.3):

  • TRIM to strip extra spaces; CLEAN to remove odd non-printing characters.
  • PROPER / UPPER / LOWER to standardize case.
  • SUBSTITUTE to fix known bad patterns (e.g. replace "St." with "Street").
  • SPLIT or Data → Split text to columns to separate combined fields.
  • Data → Data cleanup → Remove duplicates to drop exact duplicate rows, and "Trim whitespace" for a one-click space fix.
  • Fix text-dates by rebuilding with DATE() or re-entering, and set the column to a real date format.

A combined cleanup formula is common: =PROPER(TRIM(A2)) fixes case and spaces in one pass. For splitting "Last, First": =SPLIT(A2, ",") then TRIM each part.

✅ Pro Tip

Once your Staging formulas produce clean columns you're happy with, "bake" them: copy the cleaned range and use Paste special → Values only onto your analysis tab. Now the clean data stands on its own, no longer dependent on the messy source, and it's fast and portable.

Standardize & Prevent

Cleaning today is good; preventing the mess tomorrow is better. Once you have a tidy, analysis-ready table, lock in the standard:

  • Add data validation dropdowns (Lesson 3.2) to categorical columns so future entries can only be valid values — no more "In progress" vs "in-progress".
  • Set proper number and date formats so new values are typed consistently.
  • Use UNIQUE to get a clean list of the distinct values in a column — a great way to audit what's actually in there: =UNIQUE(A2:A).
  • Document the rules on a Notes tab so collaborators follow them.
⚠️ Important Note: "Remove duplicates" deletes rows permanently, so run it on a copy (your staging or analysis tab), never on your only copy of the raw data. This is exactly why the raw-data-stays-raw discipline matters — it's your safety net when a cleanup step goes further than you intended.

Analyze — Pivot and QUERY

With clean data, analysis is finally trustworthy. To reinforce both tools you've learned, answer the same question two ways — say, "total amount per category."

With a pivot table (Lesson 5.1): Insert → Pivot table, drag Category to Rows and Amount (summarized by SUM) to Values. Point-and-click, great for exploring.

With QUERY (Lesson 4.4) — here Category is in column C and Amount in D, as in the project below:

=QUERY(Analysis!A1:D, "select C, sum(D) group by C order by sum(D) desc label sum(D) 'Total'", 1)

Both should agree — if they don't, your data still has a cleanliness problem (often stray spaces making "Food" and "Food " into two categories). That cross-check is itself a cleaning test. Then visualize the result with a chart (Lesson 5.2) to finish the story.

💡 Why do both?

Pivots are fast to explore and reshuffle; QUERY is a live formula you can embed and drive from other cells. Real analysts use pivots to poke around and QUERY to power the final, self-updating outputs. Doing both here cements when to reach for which.

A Repeatable Workflow

The real deliverable of this lesson isn't one cleaned dataset — it's a process you can reuse forever. Structure your workbook into three clear stages:

graph LR A["📥 Raw tab
original data, never edited"] --> B["🧽 Staging tab
cleaning formulas"] B --> C["✨ Analysis tab
tidy values, validated"] C --> D["📊 Pivot and QUERY
trustworthy results"]
  • Raw — paste new data here; never edit it. It's your source of truth and your undo.
  • Staging — your cleaning formulas transform Raw into tidy columns.
  • Analysis — the clean, validated table (baked to values), ready for pivots and QUERY.

Next time you get a messy export, you drop it into Raw and the workflow does the rest. That's how you turn a painful chore into a two-minute routine.

🎯 Project: Clean, Then Analyze

Run the whole pipeline on a genuinely messy dataset. Make one, or paste in a real export you have.

🏋️ The full cleanup pipeline

Objective: Take dirty data to trustworthy analysis via raw → staging → analysis.

Instructions (about 30 minutes):

  1. (5 min) On a Raw tab, create ~15 messy rows: inconsistent case, extra spaces, a couple of duplicates, a "Last, First" name column, a Category column with spacing variants, and an Amount column.
  2. (8 min) On a Staging tab, clean each column: =PROPER(TRIM(...)) for text, SPLIT the name, standardize Category. Confirm the cleaned columns look right beside the raw ones.
  3. (4 min) Copy the cleaned columns and Paste special → Values only onto an Analysis tab. Run Data cleanup → Remove duplicates there.
  4. (3 min) Add validation dropdowns to the Category column on Analysis; use =UNIQUE() to audit the distinct categories.
  5. (6 min) Analyze: build a pivot table (total by category) AND a QUERY that answers the same question. Confirm they match.
  6. (4 min) Add a chart of the result and a Notes tab documenting the workflow.
💡 Hint — the cleaning formulas
Clean text:      =PROPER(TRIM(Raw!A2))
Split "Last, First": =SPLIT(Raw!B2, ",")   then TRIM the parts
Audit categories:    =UNIQUE(Analysis!C2:C)
Analyze (QUERY):     =QUERY(Analysis!A1:D,
                       "select C, sum(D) group by C order by sum(D) desc", 1)

If the pivot and QUERY totals disagree, hunt for stray
spaces or case differences — the data isn't fully clean yet.

✅ Project Completion Checklist

  • Raw data preserved untouched on its own tab
  • Staging tab cleans case, spaces, and split fields
  • Analysis tab holds baked (values-only) clean data with duplicates removed
  • Validation prevents future category mess; UNIQUE audit is clean
  • A pivot table and a QUERY answer the same question and agree
  • A chart and a documented workflow finish it off

🎯 Quick Quiz

Question 1: Why keep the raw data on its own tab and clean on a separate tab?

Question 2: Your pivot table and QUERY give different totals for "per category." What's the likely cause?

Best Practices for Cleanup

✅ Do's

  • Assess before you act — sort and scan to find the problems.
  • Clean non-destructively on a staging tab; bake to values when done.
  • Prevent recurrence with validation and documented rules.

❌ Don'ts

  • Don't Remove duplicates on your only raw copy — it's permanent.
  • Don't analyze dirty data — confident wrong answers are worse than no answer.
  • Don't forget the space/case gremlins — they silently split categories.

💡 Pro Tips

  • UNIQUE is a fast audit of what values a column really contains.
  • Cross-check a pivot against a QUERY — agreement is a cleanliness test.

📓 Learning Journal

Keep a learning journal as you work through this course — a document, a note, or a tab in your own spreadsheet. After each lesson, take a few minutes to write down:

  • Key concepts you learned
  • Techniques that clicked for you
  • Questions or confusion points to revisit
  • Ideas you want to try in your own sheets
  • Your progress and feelings about learning this

✍️ This lesson's prompt: Think of the messiest data you've had to deal with. Which cleanup steps would have tamed it fastest? Write down the raw → staging → analysis plan you'd use next time it lands in your inbox.

📝 Lesson Summary

🎓 Key Takeaways

  • Always assess dirty data first, then clean non-destructively on a staging tab.
  • Use TRIM, case functions, SUBSTITUTE, SPLIT, and Data cleanup; bake results to values.
  • Standardize and prevent with validation and a UNIQUE audit.
  • Analyze the tidy data with a pivot and a QUERY; if they disagree, the data isn't clean yet. Use a raw → staging → analysis workflow.

🎉 What You've Accomplished

You've completed all three real-world projects — a budget tracker, a task dashboard, and now a full data pipeline. You can take data from chaos to insight reliably, which is a genuinely marketable skill. You're fully prepared for the capstone, where you'll bring everything together into one interactive dashboard.

❓ Common Questions at This Stage

Should I clean with formulas or menu tools?

Both. Menu tools (Split text to columns, Remove duplicates, Trim whitespace) are fast for one-offs; formulas are better when the source keeps changing and you want repeatable cleaning. This workflow uses each where it fits.

How do I know when the data is "clean enough"?

When a UNIQUE audit shows only the values you expect, numbers SUM correctly, dates sort right, and a pivot and QUERY agree. Those checks catch the vast majority of problems.

Do I have to remove every duplicate?

Only true duplicates that would distort your analysis. Some repeated values are legitimate (two sales of the same product). Judge by whether the row represents a distinct real event.

🔭 Looking Ahead

Next — Lesson 8.1: Templates, Add-ons & Gemini / AI in Sheets — we begin the final module. You'll explore templates and add-ons, and get an honest look at the AI features arriving in Sheets, including a clear read on what's free versus paid.

✅ Before the Next Lesson

  • Save your cleanup workflow — the raw → staging → analysis structure is reusable
  • Note one cleaning trick you'll use again
  • Write your Learning Journal entry for this lesson

📚 Additional Resources

🌟 Encouragement for the Journey

Turning a messy export into a clean, trustworthy analysis is a real professional superpower — and now it's a routine you own. Three projects down; the capstone awaits. Let's finish strong. 📊