Tutorials

How to Clean Messy Spreadsheet Data: A 9-Step Checklist

Nine passes, in the order that matters. Get the order wrong and you'll deduplicate a column that still has trailing spaces, and keep every duplicate.

The SheetAI Team6 min readUpdated August 13, 2026
Clean messy data in 9 steps: scattered, messy cells turning into a tidy table. Cover image from the SheetAI blog.

Key takeaways

  • Order matters. Whitespace and case first, deduplication last.
  • Never clean in place. New columns mean you can always see what changed.
  • Numbers and dates stored as text cause most "why is my total zero" problems.
  • Finish with checks: row counts, column totals, and values that shouldn't exist.

Cleaning data has an order of operations, and most of the frustration comes from ignoring it. Remove duplicates before you trim whitespace and "Acme Corp" and "Acme Corp " both survive, so you get the satisfying feeling of having deduplicated with none of the benefit. Fix dates after you've sorted and the sort meant nothing.

Work through the passes below in sequence and each one makes the next easier. The whole thing takes about twenty minutes on a typical export, and you only have to do it once if you keep the checks at the end.

Step 1: Look before you touch

Ten minutes of looking saves an hour of fixing. For each column you want to know four things: how many rows have a value, how many distinct values there are, what type the values actually are, and what the extremes look like.

  • =COUNTA(B:B) against =COUNT(B:B). A big gap in a numeric column means text pretending to be numbers.
  • =COUNTA(UNIQUE(B2:B5000)). A country column with 340 distinct values has a problem.
  • =MIN() and =MAX(). A date range starting in 1899 means a blank got read as a date.
  • Sort ascending, then descending, and read the top ten each time. Rubbish lives at the edges.

Step 2: Fix the shape

Before touching values, sort out the structure. What you want is one header row, one record per row, one value per cell, no blank spacer rows, and no totals sitting in the middle of the data.

  1. 1Unmerge every merged cell. They break sorting, filtering and most formulas.
  2. 2Collapse multi-row headers into one row of unique names.
  3. 3Delete blank spacer rows and columns.
  4. 4Move subtotals and totals out of the data range, or they'll double-count everything downstream.
  5. 5Where a value appears once and applies to the rows beneath it, fill it down.

Step 3: Strip whitespace and invisible characters

Best value for effort in the whole list, because the problem is invisible. TRIM removes leading, trailing and repeated internal spaces. CLEAN removes non-printable characters. Neither removes the non-breaking space that comes with anything pasted from a web page or a PDF, which is why this catches people out.

The full strip
=TRIM(CLEAN(SUBSTITUTE(A2, CHAR(160), " ")))
Ordinary whitespace, control characters, and the non-breaking space that TRIM leaves behind.

Step 4: Fix numbers stored as text

A number stored as text left-aligns, gets ignored by SUM, and won't match in a lookup against a real number. The usual culprits are currency symbols, thousands separators, trailing spaces, a leading apostrophe, or European decimal commas.

Diagnose
=ISNUMBER(D2)
FALSE on a cell that obviously contains a number is your confirmation.
Repair
=VALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(D2,"$",""),",",""),CHAR(160),""))

Step 5: Repair the dates

Dates break in two directions. Some are text that looks like a date. Some are real dates parsed with the wrong locale, so 03/04/2026 is either the third of April or the fourth of March depending on where the file came from, and the file won't tell you which.

  • Real dates right-align. Text left-aligns. That's the two-second check.
  • =ISNUMBER(A2) returns TRUE for real dates, since they're just formatted numbers underneath.
  • If day and month might be swapped, look for any row where the day is above 12. If there aren't any, the data can't tell you, and you need to ask whoever exported it.
  • =DATEVALUE() converts text dates. Say which order the source uses when it's ambiguous.

Step 6: Standardise the categories

With whitespace and case sorted, what's left is real variation. Ltd against Limited, NY against New York, enterprise against Enterprise Plan. There are two ways to handle it and you want both.

1

Write down the allowed values

Pick the vocabulary first, ideally matching whatever your CRM or warehouse uses, because that's where this data has to join eventually.

2

Map the long tail

Sort by frequency and you'll find a handful of variants cover most rows. Do those by hand, then let AI propose mappings for the rest. Tedious but mechanical is exactly what AI is good at.

3

Flag rather than guess

Anything it can't place confidently should come back as UNMAPPED. A short review list costs you five minutes. A silently wrong category costs you a meeting.

4

Add validation

Once the column is clean, restrict it to the allowed list so it doesn't drift again the next time someone types in it.

Step 7: Decide what blanks mean

A blank means one of three quite different things, and treating them all as zero will quietly distort every average you calculate afterwards.

What it meansWhat to doThe usual mistake
Genuinely zeroWrite 0Leaving it blank, so COUNT undercounts
Not collectedLeave blank or mark N/AFilling with 0 and dragging the average down
Not applicableMark N/A explicitlyTreating it as missing data to be estimated

Step 8: Deduplicate, last

Now that whitespace is gone, case is normalised and categories are consistent, deduplication will actually find the duplicates you have.

Decide what makes two rows duplicates before you delete anything. Identical across every column is easy. "Same customer, different email" is a business rule and somebody has to state it. Build the key in its own column, count with COUNTIF, look at everything above one, then remove. In that order. Don't start with the Remove Duplicates button on a whole sheet, because it deletes without ever showing you what it took.

Step 9: Prove it worked

Last pass is a set of questions the clean data should answer correctly. Write them as formulas so they run again next month.

  1. 1Row count before and after. Does the difference match the duplicates you meant to remove?
  2. 2Column totals before and after. For anything you didn't intend to change, they must be identical.
  3. 3Range checks. Any negative quantities, dates in the future, percentages over 100?
  4. 4Referential checks: every customer ID in the orders tab exists in the customers tab?
  5. 5Distinct counts. Is each category column now inside the vocabulary you defined?

Where AI actually helps here

Steps 1, 6 and 9 are where an assistant earns its keep. Profiling forty columns at once, proposing mappings for a long tail of category variants, and drafting the validation checks you'd otherwise skip. Steps 4, 5 and 8 are rule-based, so it can write the formulas, but the rules should be yours. Only you know whether a blank means zero.

Clean a messy export in one pass

Point SheetAI at the file. It profiles every column, proposes the fixes, and writes them into new columns so nothing is lost.

Clean a file in SheetAI

Frequently asked questions

Why does my SUM return 0 when the cells clearly contain numbers?

›
They're text, not numbers. Check with =ISNUMBER(). Usual causes are currency symbols, thousands separators, non-breaking spaces from a web paste, a leading apostrophe, or a decimal comma from a European locale. Strip the offending characters, then convert with VALUE().

Should I remove duplicates first or clean the data first?

›
Clean first, every time. Deduplication compares values exactly, so 'Acme Corp' and 'Acme Corp ' are two different rows until you trim and normalise case. Running it on raw data leaves most duplicates in place while making you think the job is done.

How do I fix dates where the day and month are swapped?

›
Look for rows where the day part is above 12, which proves the order. If there aren't any, the data genuinely can't tell you and you need to confirm with whoever exported it. Guessing here corrupts about a third of your dates without any visible sign.

Can AI clean spreadsheet data automatically?

›
It can do the mechanical parts: profiling columns, proposing category mappings, writing the repair formulas, drafting validation checks. What it shouldn't decide is meaning. Whether a blank is a zero, what counts as a duplicate customer, which spelling is the canonical one.

How long should cleaning a dataset take?

›
A typical business export runs about twenty minutes by this checklist, most of it in steps 1 and 6. If it's taking hours, the problem is usually upstream in how the file is exported, and fixing that once beats cleaning it every month.

Written by The SheetAI Team

We build SheetAI, an AI spreadsheet assistant that reads your data, writes the formulas, and shows its work. We write about the spreadsheet problems we keep running into.

Get started

Put this to work on your own spreadsheet

Upload a file, ask in plain English, and watch SheetAI write the formulas into the sheet, with every step visible so you can check the work.

All articles

Works in your browser and Google Sheets · Setup in 30 seconds