Skip to content
← All Blogs
Excel data cleaning

How to clean messy Excel data before you analyze it

Quick answer

Clean a messy Excel file in a fixed order. Keep an untouched _original copy, fix the header row, unmerge cells, convert money, dates and IDs one column at a time, trim spaces, remove duplicates, then check ranges. Finish with a short change log so anyone can see why your totals differ from the raw export.

The file arrives at 6:11pm on a Friday: Master_List_FINAL_v3(2).xlsx, 8,400 rows, with a note from the sales team: "Here's the data, can we see the numbers on Monday?" You scroll to the Amount column and the weekend plan changes. Excel and Power BI will read that column as text, every sum over it will come back blank or zero, and on Tuesday someone will ask why revenue "looks broken." Nobody sees this part of the work in the final chart, so the aim is to make it fast, dull and identical every time.

Read the column before you fix anything

The instinct is to start deleting. Don't. Spend ninety seconds profiling first, because the fix depends on how the column is broken. Sort the column ascending, then descending. Text values sort separately from numbers, so genuine numbers gather at one end and the junk lands at the other, and that split alone shows how much of the column is text. Then run =COUNTBLANK(D2:D8401) and =SUMPRODUCT(--ISTEXT(D2:D8401)) to count how many cells are text instead of numbers. Now you know the size of the problem instead of guessing.

The example: one Amount column, six kinds of wrong

Here is what an Amount column like this often contains:

Amount
$1,240.00
1240
1,240
USD 1,240
(320)
1240      <- trailing space
—

Six ways of writing a number, and only one of them (1240) is a number a spreadsheet will trust. The dollar sign and the USD prefix force the cell to text. The comma works in a US locale but breaks on a machine set to a European one. (320) is accounting notation for minus 320 and imports as the literal text "(320)". The dash is someone saying "no value," which is not the same as zero. The trailing space is invisible, which makes it the hardest to spot.

You can fix five of these in one pass with a formula. In an adjacent column:

=IFERROR(
   VALUE(
     SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(
       TRIM(D2),"$",""),"USD",""),",",""),"(","-")
   ), "")

That strips the currency symbols and thousands separators, trims the spaces, turns the opening bracket into a minus sign, and returns a real number, or an empty string if the cell was the dash, so a blank stays blank instead of becoming a false zero. Paste Special the result back as values, and the column finally adds up.

A repeatable cleaning sequence

Run these seven steps in this order on any messy file, whether it's a sales export, a supplier price list or an expense sheet. Order matters: fixing values before structure means fixing the values twice.

  1. Copy the raw sheet to a tab named _original and never touch it. You will want to show what changed.
  2. Promote the real header row and delete title banners, logos or blank spacer rows above the data.
  3. Unmerge every merged cell and fill the value down so each row stands on its own.
  4. Fix one column type at a time: money, then dates, then IDs, using the formula pattern above.
  5. Trim spaces everywhere with TRIM, so " Acme " and "Acme" stop counting as two customers.
  6. Remove duplicates on the key column, checking near-matches ("Acme Corp" vs "Acme Corp.") as well as exact ones.
  7. Validate ranges: no negative quantities, dates inside the reporting period, required fields filled in. Flag odd rows for the person who sent the file instead of silently deleting them.

Keep a record of what you changed

When you share the cleaned file or the chart built from it, add a short change log in plain words: "Converted 412 text amounts to numbers, removed 3 duplicate customers, flagged 11 rows with dates outside Q3." That paragraph answers the first question anyone asks when your total differs from the raw export, and it lets the next person repeat the work without starting from zero.

Weighing your options? See our data cleansing and transformation tool comparisons.

Dotwave finds text that should be money or dates, shows how many values each fix would change before you apply it, and writes every step to a plain-English audit trail. Once the data is clean, you can ask your data a question such as "revenue by month" and get a chart built from your real columns.

Create your free account
More articles

Keep reading

All articles →

Clean your next file in Dotwave

Fixes you approve, a plain-English record of every change, and a dashboard you send by link, PDF or scheduled email.

Create your free account

Free plan, no card required