๐ Lesson 7.3: Project โ A Data Cleanup & Analysis Workflow
Real data almost never arrives clean. It comes from an export, a form, another system โ full of inconsistent capitalization, stray spaces, names split or joined the wrong way, dates in three different formats, and duplicate rows. Before you can analyze anything, you have to clean it. In this project you'll take a genuinely messy dataset and walk the full analyst workflow: clean โ structure โ analyze โ conclude. You'll fix the mess with text functions and Flash Fill, structure it as a Table, strip duplicates, analyze it with a PivotTable and dynamic arrays, and finish by writing a plain-English insight โ because analysis that doesn't end in a conclusion isn't finished.
๐ What You'll Learn
By the end of this lesson, you will be able to:
- Recognize the common ways imported data is dirty โ case, spaces, split/joined fields, mixed dates, duplicates
- Clean text with
TRIM,PROPER,LEFT/RIGHT/MID,TEXT, and Flash Fill - Know when to reach for Power Query as the repeatable cleanup tool
- Structure clean data as a Table and remove duplicates safely
- Analyze with a PivotTable,
SUMIFS/COUNTIFS, and dynamic arrays (FILTER,UNIQUE,SORT), then write a short insight
โฑ๏ธ Estimated Time: 60 minutes
๐ฏ Project: Take a messy sales dataset, clean it into a tidy Table, remove duplicates, analyze it (PivotTable + dynamic arrays), and write a one-paragraph insight backed by the numbers.
In This Lesson
The Analyst Workflow: Clean โ Structure โ Analyze โ Conclude
Here is a truth every working analyst learns fast: the analysis is the easy part. The cleaning is where the time goes. Surveys of data professionals routinely find they spend the majority of their time just preparing data before any real analysis begins. That's not a failure โ it's the job. Dirty data doesn't just look untidy; it produces wrong answers. Count "Alice Nguyen" and "alice nguyen " as two different customers and your customer count is inflated and your per-customer totals are wrong, silently and confidently.
So we follow a disciplined, repeatable workflow โ four stages, always in this order:
| Stage | Goal | Typical tools |
|---|---|---|
| 1. Clean | Make every value consistent and correct | TRIM, PROPER, LEFT/RIGHT/MID, TEXT, Flash Fill, Power Query |
| 2. Structure | Turn the range into a proper dataset | Convert to Table, Remove Duplicates, correct data types |
| 3. Analyze | Ask the data questions | PivotTable, SUMIFS/COUNTIFS, FILTER/UNIQUE/SORT |
| 4. Conclude | State what it means, in words | A written insight backed by the numbers |
consistent, correct values"] --> B["๐๏ธ Structure
Table and remove duplicates"] B --> C["๐ Analyze
PivotTable and dynamic arrays"] C --> D["โ๏ธ Conclude
a written insight"]
The last stage is the one beginners skip and professionals never do. Numbers on a screen aren't insight โ insight is a sentence a decision-maker can act on: "West region drove 41% of revenue but has the fewest reps โ worth investing there." We'll finish this project by writing a sentence just like that. Clean, structure, analyze, conclude.
๐ง Mindset
Cleaning can feel like drudgery, but reframe it: every fix you make is a wrong answer you just prevented. And the goal isn't only a clean sheet this time โ it's a repeatable process, so that next month's export cleans itself. That's why we'll clean with formulas and mention Power Query rather than just hand-editing cells: hand-editing fixes today's file; a repeatable recipe fixes every file.
Meet the Messy Data
Here's our starting point: a sales export that's typical of what lands in your inbox. Notice everything wrong with it โ
mixed capitalization, trailing and doubled spaces, a full name in one column that we'll need to split, dates in three
different formats, and a duplicate row. Type this (messiness and all) into a new sheet named Raw, starting
at A1:
Raw sheet โ the messy import
A B C D
1 Customer Region Order Date Amount
2 alice nguyen west 2026-01-05 1200
3 BEN CARTER East 01/07/2026 450
4 carla ruiz WEST Jan 9, 2026 980
5 ben carter east 01/07/2026 450
6 DANA LEE North 2026-01-11 1750
7 alice nguyen West 2026-01-14 600
8 Evan Ortiz south 2026-01-18 320
9 carla ruiz west 2026-01-21 1100
10 DANA LEE north Jan 25, 2026 890
Let's name the problems precisely, because you can't clean what you can't see:
- Inconsistent case: "alice nguyen", "BEN CARTER", "carla ruiz" โ a mix of lower, upper, and messy.
- Extra spaces: row 4 has a double space in "carla ruiz", row 7 has a leading space before "alice".
- Region case: "west", "WEST", "West" look like three different regions. (Excel's SUMIFS, COUNTIFS, PivotTables, and Remove Duplicates actually ignore capitalization and lump them together โ but the report shows whichever spelling Excel met first, and case-sensitive tools such as Power Query would split them.)
- Mixed date formats: ISO (
2026-01-05), slash (01/07/2026), and text (Jan 9, 2026) all mixed together โ some may not even be real dates to Excel. (On a US-set Excel01/07/2026means January 7; on day-first settings it would read as July 1 โ always check slash dates after an import.) - A duplicate row: rows 3 and 5 are the same order (Ben Carter, East, same date, same amount) entered twice.
- One column, two facts: Customer holds a first and last name we may want to split.
If you built a PivotTable on this raw data right now, it would be wrong โ "alice nguyen" and " alice nguyen" (that leading space) as two different customers, "carla ruiz" and "carla ruiz" as two more, a double-counted Ben Carter order inflating East, region labels in whatever capitalization came first, and dates it can't sort. That's exactly why we clean before we analyze. Let's fix it, one problem at a time.
Step 1 โ Clean the Text (TRIM, PROPER, MID & Flash Fill)
The safest way to clean is non-destructively: leave the Raw data untouched and build cleaned columns beside it with formulas. That way you can always see what changed, and if a formula is wrong you fix the formula, not re-type the data. Create a Clean sheet (or use columns to the right on the Raw sheet). We'll reference the raw cells and transform them.
Fix spaces and case at once
TRIM removes leading, trailing, and doubled-up internal spaces; PROPER capitalizes the first
letter of each word. Nest them and one formula fixes both problems (functions from Lesson 2.3):
Clean the Customer name (both problems in one go)
=PROPER(TRIM(Raw!A2)) โ "alice nguyen" becomes "Alice Nguyen"
" alice nguyen" becomes "Alice Nguyen"
"carla ruiz" becomes "Carla Ruiz"
Fix the Region the same way:
=PROPER(TRIM(Raw!B2)) โ "WEST" / "west" / "West" all become "West"
Read it inside-out: TRIM runs first and hands its cleaned-up text to PROPER. Now every region
and customer is spelled, spaced, and cased identically, which is the whole point โ the PivotTable later will show one
clean "West" and one entry per customer.
Split the full name into First and Last
Splitting "Alice Nguyen" into two columns is a classic. There are two great ways, and it's worth knowing both.
Way 1 โ text functions. Find the space with FIND, then grab the pieces with
LEFT and MID:
First name =LEFT(CleanName, FIND(" ", CleanName)-1)
Last name =MID(CleanName, FIND(" ", CleanName)+1, 100)
FIND(" ",...) returns the position of the space.
LEFT takes everything before it; MID takes everything after it.
(The 100 just means "grab the rest" โ any number bigger than the name works.)
Way 2 โ Flash Fill. This feels like magic. In the column next to your names, type the first name for the first row or two by hand, and Excel detects the pattern and offers to fill the rest. Type it and press Enter โ or trigger it deliberately with Ctrl+E:
Flash Fill (Ctrl+E) โ no formula needed
Cleaned name You type Flash Fill guesses the rest
Alice Nguyen --> Alice --> Ben, Carla, Dana... (first names)
Alice Nguyen --> Nguyen --> Carter, Ruiz, Lee... (last names)
โ ๏ธ Flash Fill vs formulas โ a real trade-off
Flash Fill is brilliant for a one-time split and needs no formula โ but it's a static
action: it fills values once and does not update if the source data changes. Formulas
(LEFT/MID) are live โ change the name and the split updates โ but you have to write them.
Rule of thumb: Flash Fill for a quick one-off, formulas (or Power Query) when the cleanup must repeat. Flash Fill is on
the desktop app and Excel for the web, though the automatic prompt is most reliable on desktop.
The TEXT function is your friend for formatting numbers and dates as clean text โ for example
=TEXT(Raw!C2,"yyyy-mm-dd") forces a real date into a tidy ISO string, and =TEXT(Raw!D2,"$#,##0")
turns 1200 into "$1,200" for a label. We'll use it in the next step to tame the dates.
Step 2 โ Fix Dates & the Power Query Option
Dates are the trickiest mess because some of your "dates" may not be dates at all โ Excel may have stored
Jan 9, 2026 or 01/07/2026 as text, especially after an import. A text date won't sort,
filter, or feed a PivotTable's date grouping. The goal is to get every value into a single, genuine date
that Excel recognizes.
First, spot the text dates: real dates are right-aligned by default; text dates sit left-aligned. (If you typed the Raw
data by hand, Excel may already have turned all three formats into real dates โ in a real import, some usually arrive
as text.) To convert text that looks like a date into a true date, DATEVALUE often does it โ but
use it only on the text dates, because pointed at a cell that's already a real date it returns
#VALUE!:
Convert a text date to a real date
=DATEVALUE(Raw!C4) โ turns the text "Jan 9, 2026" into a real date serial
One formula for a mixed column (keeps real dates, converts text ones):
=IFERROR(DATEVALUE(Raw!C2), Raw!C2)
Then display them all consistently (Home โธ Number Format โธ Short Date),
or force a tidy text label with:
=TEXT(DateCell, "yyyy-mm-dd") โ 2026-01-09
For a whole column of mixed text dates, the fastest fix is often Data โ Text to Columns: select the column,
click through the wizard, and on the last step choose Date as the column format โ Excel re-parses each
value into a real date. It's a desktop favorite; on the web, DATEVALUE plus a consistent number format does the
same job. Once every date is a real date, they sort correctly and the PivotTable can group by month.
The repeatable option: Power Query
Everything above cleans this file. But imagine you get this same export every week. Re-doing the formulas and Text-to-Columns by hand each time is exactly the kind of tedious, error-prone chore computers should do for you. That's what Power Query is for (introduced in Lesson 6.2): you record the cleanup steps once โ trim, proper-case, split column, change type, remove duplicates โ and Power Query saves them as a recipe. Next week, drop in the new file and click Refresh; every step re-runs automatically.
โ ๏ธ Power Query โ mostly a desktop strength (honest scope)
Power Query (the Get & Transform tools) is far more complete in the desktop app โ the full query editor, the huge list of transformations, and refreshable connections live there. Excel for the web has been gaining Power Query abilities but remains more limited; check Microsoft's current support pages for what your version supports, as it changes over time. For this course you can complete the cleanup with formulas and Flash Fill on any version โ just know that Power Query is the professional's answer to "I have to do this every week."
The takeaway isn't "learn Power Query right now" โ it's to recognize the fork in the road: one-time cleanup (formulas and Flash Fill are perfect) versus repeated cleanup (Power Query pays for itself many times over). Knowing which situation you're in is the mark of an analyst thinking ahead.
Step 3 โ Structure & Remove Duplicates
With clean columns built, "set" the cleaned values so they're no longer dependent on the messy originals, then structure them as a Table. To lock in values from formula columns, select them, Ctrl+C to copy, then Paste Special โ Values (Ctrl+Shift+V on the web) โ this replaces the formulas with their results so you can safely delete the raw data. Your clean, structured dataset should look like this:
Clean sheet โ after cleaning (First/Last split, tidy Region & Date)
A B C D E
1 First Last Region Order Date Amount
2 Alice Nguyen West 2026-01-05 1200
3 Ben Carter East 2026-01-07 450
4 Carla Ruiz West 2026-01-09 980
5 Ben Carter East 2026-01-07 450 โ duplicate of row 3
6 Dana Lee North 2026-01-11 1750
7 Alice Nguyen West 2026-01-14 600
8 Evan Ortiz South 2026-01-18 320
9 Carla Ruiz West 2026-01-21 1100
10 Dana Lee North 2026-01-25 890
Convert this to a Table with Ctrl+T and name it tblSales. Now remove the duplicate.
Select any cell in the Table, then Table Design โ Remove Duplicates (or Data โ Remove Duplicates). A
dialog lets you choose which columns define a duplicate โ tick First, Last, Region, Order Date, and Amount so a row counts as
a duplicate only when all of those match. Excel removes the extra Ben Carter row and tells you how many it deleted.
โ ๏ธ Remove Duplicates is destructive โ think first
Remove Duplicates permanently deletes rows. Two safeguards: first, keep your Raw sheet so
you always have the untouched original. Second, be careful which columns you check โ if you only tick
"First" and "Last," you'd wrongly delete Alice's second, legitimate order (a different date and amount). A row is only a
true duplicate when the fields that should be unique together all match. When unsure, sort and eyeball first, or
use COUNTIFS to flag suspected duplicates before deleting.
You now have a tidy, structured, de-duplicated Table โ the "structure" stage complete. This is the moment the data becomes trustworthy enough to analyze. Everything before this was preparation; everything after is payoff.
Step 4 โ Analyze & Conclude
Clean data makes analysis quick and its answers trustworthy. Let's ask our sales data a few real questions three ways โ
with a PivotTable, with SUMIFS/COUNTIFS, and with dynamic arrays โ then write the conclusion.
A PivotTable for the big picture
Click in tblSales โ Insert โ PivotTable. Drag Region to Rows and
Amount (Sum of) to Values. In seconds you get revenue per region โ and because the data is clean, "West"
appears exactly once with the correct total. Add Order Date to Rows (grouped by month) to see revenue over
time, or Last and First to see your best customers.
SUMIFS / COUNTIFS for specific numbers
When you want a single figure in a cell (to headline or reuse), reach for the *IFS family you used in the earlier projects:
Revenue from the West region:
=SUMIFS(tblSales[Amount], tblSales[Region], "West")
Number of orders in the West:
=COUNTIFS(tblSales[Region], "West")
Average order value in the West:
=AVERAGEIFS(tblSales[Amount], tblSales[Region], "West")
Total revenue overall:
=SUM(tblSales[Amount])
Dynamic arrays for instant lists
If your Excel is Microsoft 365 or the web, dynamic arrays (Lesson 4.4) are a joy here. One formula "spills" a whole list of results โ perfect for building a clean report:
A sorted list of unique regions (spills down automatically):
=SORT(UNIQUE(tblSales[Region]))
Every order from the West, largest first:
=SORT(FILTER(tblSales, tblSales[Region]="West"), 5, -1)
(5 = sort by the 5th column, Amount; -1 = descending)
Customers who spent over 1000 on a single order:
=FILTER(tblSales, tblSales[Amount]>1000)
โ ๏ธ Dynamic arrays are modern
FILTER, UNIQUE, and SORT are available on Microsoft 365 and Excel for
the web. On older perpetual Excel (2019 and earlier) they don't exist โ you'd fall back on a
PivotTable, Advanced Filter, or older array formulas to get the same results. If a formula shows #NAME?,
that's the tell that your version lacks the function.
Conclude โ write the insight
This is the step that turns numbers into value. Look at your results and write one honest paragraph a decision-maker could act on. For our data, something like:
Insight: The West region is the clear revenue leader, contributing just over half of total sales (3,880 of 7,290) across four orders from two customers, Alice Nguyen and Carla Ruiz โ though its average order (970) is below North's. North performed strongly on few orders, driven by two large purchases from Dana Lee (an average of 1,320). South is the weakest region and had only one small order. Recommendation: the data suggests West is worth deeper investment, while South needs investigation โ is it under-served, or simply a smaller market?
Notice the shape: a claim, the numbers behind it, and a recommendation. That's the difference between "here's a spreadsheet" and "here's what I found and what we should do." A conclusion in plain language is the deliverable โ the cleaning and analysis were all in service of being able to write it with confidence.
๐ Why the order is non-negotiable
Had we analyzed before cleaning, the insight would have been wrong: customers split in two by stray spaces, a double-counted Ben Carter order inflating East, messy region labels, and dates that wouldn't group. Clean data isn't a nicety โ it's what makes the conclusion true. Clean โ structure โ analyze โ conclude, always in that order.
๐ฏ Project: Run the Whole Workflow
Take the messy dataset from start to finish โ clean it, structure it, remove the duplicate, analyze it, and write your insight. This is the exact process you'll use on real data for the rest of your working life, so do it properly end to end.
๐๏ธ Clean, structure, analyze, conclude
Objective: Turn the Raw sales export into a tidy Table and a short, evidence-backed insight.
Instructions (about 45 minutes):
- (5 min) Type the messy data onto a Raw sheet exactly as shown (keep it as your untouched original).
- (12 min) On a Clean sheet, build cleaned columns:
=PROPER(TRIM(...))for Customer and Region; split the name into First/Last withLEFT/MIDor Flash Fill (Ctrl+E). - (6 min) Convert all dates to real dates (
DATEVALUEor Text to Columns) and display them consistently. - (6 min) Paste the cleaned values as values, convert to a Table named
tblSales, and Remove Duplicates (matching on all key columns). - (10 min) Analyze: build a PivotTable of revenue by Region; compute West revenue/orders/average with
SUMIFS/COUNTIFS/AVERAGEIFS; if available, list results withSORT,UNIQUE,FILTER. - (6 min) Write a one-paragraph insight: a claim, the numbers behind it, and a recommendation.
๐ก Hint โ the core formulas in one place
Clean text (Customer / Region):
=PROPER(TRIM(Raw!A2))
=PROPER(TRIM(Raw!B2))
Split name:
First =LEFT(name, FIND(" ",name)-1)
Last =MID(name, FIND(" ",name)+1, 100)
(or just Flash Fill with Ctrl+E)
Fix a text date:
=DATEVALUE(Raw!C4) then format as Short Date
(text dates only โ or =IFERROR(DATEVALUE(Raw!C2), Raw!C2) for
the whole column, or Data โธ Text to Columns โธ Date)
Structure: paste as Values โธ Ctrl+T โธ name tblSales โธ Remove Duplicates
Analyze:
=SUMIFS(tblSales[Amount], tblSales[Region], "West")
=COUNTIFS(tblSales[Region], "West")
=AVERAGEIFS(tblSales[Amount], tblSales[Region], "West")
=SORT(UNIQUE(tblSales[Region]))
=SORT(FILTER(tblSales, tblSales[Region]="West"), 5, -1)
If FILTER/UNIQUE/SORT give #NAME?, your Excel version is older
โ use the PivotTable instead. If a total looks too big, you probably haven't removed the duplicate yet.
โ Project Completion Checklist
- A Raw sheet preserved untouched, and a Clean sheet with consistent case and no stray spaces
- The name split into First and Last (via functions or Flash Fill)
- Every Order Date is a genuine date, displayed consistently
- Clean data structured as
tblSaleswith the duplicate row removed - Analysis done with a PivotTable and at least one
SUMIFS/COUNTIFS(and dynamic arrays if available) - A one-paragraph written insight: claim + numbers + recommendation
๐ฏ Quick Quiz
Question 1: Why do we clean the data before building the PivotTable, rather than after?
Question 2: When is Power Query the better choice over Flash Fill and one-off formulas?
Best Practices for Cleaning & Analysis
โ Do's
- Always keep the raw original on its own sheet. Clean non-destructively so you can trace and undo any change.
- Clean, then structure, then analyze. Never analyze dirty data โ the answers will be confidently wrong.
- Prefer repeatable cleanups (formulas, then Power Query) over hand-editing when the data recurs.
- End with a written insight. A claim, the numbers behind it, and a recommendation โ that's the deliverable.
โ Don'ts
- Don't hand-edit cells one by one when a formula or Flash Fill can do the whole column โ it's slower and error-prone, and it doesn't repeat.
- Don't run Remove Duplicates carelessly. Choose the key columns thoughtfully so you don't delete legitimately different rows.
- Don't trust a total on data you haven't de-duplicated โ a repeated row silently inflates every sum and count.
- Don't stop at the numbers. A pile of pivots isn't analysis until you say what it means.
๐ก Pro Tips
- Add a helper column
=COUNTIFS(range, criteria)>1to flag suspected duplicates before deleting anything โ safer than deleting blind. CLEANremoves non-printing characters (a common import gremlin); pair it withTRIM:=PROPER(TRIM(CLEAN(A2))).- Once you've built a good cleanup with formulas, that same logic is exactly what you'd record as Power Query steps later โ you're already thinking in a repeatable pipeline.
๐ Learning Journal
Keep a learning journal as you work through this course โ a separate document, a note, or even a second worksheet right in the workbook you're building. 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 with your own data
- Your progress and feelings about learning this โ including where your confidence grew
โ๏ธ This lesson's prompt: Think of a real messy dataset in your own life โ an export from your bank, a sign-up list, a spreadsheet a colleague sent. What's dirty about it, and which cleaning tool from this lesson (TRIM/PROPER, split, date fix, remove duplicates) would you reach for first? Then imagine the one-sentence insight you'd most want it to give you. Practicing the clean โ structure โ analyze โ conclude loop on your own data is how it becomes second nature.
๐ Lesson Summary
๐ Key Takeaways
- The analyst workflow is clean โ structure โ analyze โ conclude, always in that order โ dirty data produces confidently wrong answers.
- Clean text with
TRIM(spaces),PROPER(case), andLEFT/MID/FIND(splitting); Flash Fill (Ctrl+E) splits by example but is static, while formulas stay live. - Get every date into a real date (
DATEVALUEor Text to Columns) so it sorts, filters, and groups; use Power Query when the same messy file recurs and you want a repeatable, refreshable cleanup (strongest on desktop). - Structure clean data as a Table and Remove Duplicates carefully โ choosing the right key columns and always keeping the raw original.
- Analyze with a PivotTable,
SUMIFS/COUNTIFS, and dynamic arrays (FILTER/UNIQUE/SORT, modern Excel) โ then conclude with a written insight: claim, numbers, recommendation.
๐ What You've Accomplished
You just did what professional analysts get paid to do: took ugly, untrustworthy data and turned it into a clean dataset and a defensible conclusion. You practiced the full loop โ clean, structure, analyze, conclude โ and you know the difference between a one-time fix and a repeatable pipeline. This is arguably the most transferable skill in the whole course.
โ Common Questions at This Stage
My cleaned column shows the formula result, but I deleted the raw data and now it's all errors. Help?
That's because the cleaned column still referenced the raw cells. Before deleting the originals, convert the formula results to fixed values: select the cleaned range, Ctrl+C, then Paste Special โ Values. Now the cleaned data stands on its own and you can safely remove the raw columns (though keeping the Raw sheet as a backup is still wise).
Should I use Flash Fill or formulas to clean?
Flash Fill (Ctrl+E) is fastest for a one-time job โ split a name, reformat a code โ and needs no formula. But it's static: it won't update if the source changes. Use formulas (or Power Query) when the cleanup needs to stay live or repeat. Many analysts use Flash Fill to explore, then formalize with formulas once they know the pattern.
Does all of this work on free Excel for the web?
The core does: TRIM, PROPER, LEFT/RIGHT/MID,
DATEVALUE, Tables, Remove Duplicates, PivotTables, and dynamic arrays all work on
Excel for the web. The big honest exceptions are
Power Query (much more complete on desktop) and Text to Columns (a desktop favorite) โ
on the web, lean on DATEVALUE and formulas instead. Check Microsoft's current pages, as web features grow
over time.
๐ญ Looking Ahead
That's Module 7 complete โ three real projects behind you. In the next lesson โ Lesson 8.1: Templates, Add-ins & Copilot/AI in Excel (Honest Free vs Paid) โ we open Module 8 by looking at how to move faster: starting from ready-made templates, extending Excel with add-ins, and using Copilot and AI features โ with an honest breakdown of what's free versus what needs a paid subscription.
โ Before the Next Lesson
- Finish the cleanup project end to end and confirm your PivotTable shows one "West" with the correct total
- Write your one-paragraph insight โ practice the claim + numbers + recommendation shape
- Write your Learning Journal entry for this lesson
๐ Additional Resources
- Microsoft Excel Help & Learning (Microsoft Support)
- Get & Transform (Power Query) in Excel โ Microsoft Support
- microsoft365.com โ open Excel for the web
๐ Encouragement for the Journey
Cleaning data isn't glamorous, but you just learned the skill that makes every other skill trustworthy โ and you finished with a real conclusion, not just a pile of numbers. That's the whole job of an analyst, and you can do it now. Three projects done, Module 8 and the capstone ahead. You're nearly at the dashboard you've been building toward since Lesson 1. ๐