Home › AI at work › Clean messy data

Clean up a messy spreadsheet with AI

Duplicates, dates in three formats, "north" and "North " counting as different regions. Fix the lot in minutes, either with the AI telling you what to click or by letting it clean the file for you.

Starter 30 minutes Free · practice file included Two routes, one keeps data in Excel
Before: 314 rows
ABCDG
1Order IDOrder DateCustomerRegionPrice
2ORD-116003/05/2026 Brightside CafeWest£29.99
3ORD-116003/05/2026 Brightside CafeWest£29.99
4ORD-114909/01/2026Maple Vetseast129.00
5ORD-116510 Jan 2026Lantern StudioEast45.00
6ORD-12642026-01-06Pebble & CoEast 29.99
After: 300 rows, ready to use
ABCDG
1Order IDOrder DateCustomerRegionPrice
2ORD-11602026-05-03Brightside CafeWest29.99
3ORD-11492026-01-09Maple VetsEast129.00
4ORD-11652026-01-10Lantern StudioEast45.00
5ORD-12642026-01-06Pebble & CoEast29.99
14 duplicates removed · dates, spaces, capitals and £ signs fixed
What you'll be able to do

A spreadsheet you can actually trust

Messy data is why reports don't add up. This guide shows two ways to fix it: AI as your guide inside Excel, or AI doing the cleaning and handing back a tidy file.

  • Find and remove duplicate rows, and know how many there were
  • Turn a column of mixed date formats into real dates Excel can sort and filter
  • Remove stray spaces and fix inconsistent capitals ("north", "NORTH ", "North")
  • Strip currency symbols so prices become numbers you can add up
  • Flip "Surname, First name" into "First name Surname"
  • Spot blanks and problems before they ruin a report

Good for: anyone who combines exports from different systems, people who get "the data" from colleagues, and anyone whose totals never quite match.

Before you start

What you need

Excel or Google Sheets
An AI chat assistant that accepts file uploadsClaude, ChatGPT, Gemini, or Copilot if your work provides it. Uploads may need a free account. Route A works with any of them.
The messy practice fileDownload office-supplies-sales-messy.csv. It has 314 rows of made-up orders with 14 duplicates, mixed date formats, stray spaces, "£" signs, back-to-front names and a few blank quantities hidden in it.
Work data and AI: read this first. Before you upload any real work file to an AI, check your company's AI policy. Never put customer details, salaries or anything confidential into a personal AI account. If your workplace provides Copilot or a company AI plan, use that. If you're unsure, use Route A, which never uploads the data.
Step by step

Do it in five steps

  1. Get the AI to spot the problems

    Open the messy file in Excel. Copy the header row and about 10 rows of data, then paste them into the AI with this prompt. (With real work data, change names and numbers before pasting. The AI only needs to see the shape of the mess.)

    Copy this prompt
    I'm not an Excel expert. Here are the first rows of a spreadsheet I need to clean up. Please look at it and list every data quality problem you can see (duplicates, inconsistent formats, spaces, symbols, blanks and anything else), in plain English, with which column each one is in.
    
    [paste the rows here]

    You'll get a checklist. That alone is useful, because you now know what to fix before you build a report.

  2. Route A: Have the AI walk you through fixing it in Excel

    Copy this prompt
    Thanks. I want to fix all of these in Excel (Microsoft 365) myself, without uploading the file. The data is on a sheet called "Sales", headers in row 1, data in rows 2 to 315. Columns: A Order ID, B Order Date, C Customer, D Region, E Product, F Quantity, G Unit Price, H Sales Rep.
    
    Please give me numbered steps a beginner can follow, one problem at a time. For each step, tell me exactly what to click or the exact formula to use, and how to check it worked. Start with removing duplicate rows, then the rest.

    Expect steps like these:

    • Duplicates: select the data, then Data › Remove Duplicates. Excel tells you how many it removed. In the practice file it should be 14, leaving 300 rows.
    • Spaces and capitals: a helper column with a formula like =PROPER(TRIM(D2)), copied down, then Paste Special › Values back over the original.
    • "£" signs: Find & Replace "£" with nothing.
    • Dates: a formula or Text to Columns to turn text into real dates. This is the fiddliest one, so ask follow-up questions.
    • Names: a formula to flip "Grant, Quinn" into "Quinn Grant".

    Work through them one at a time. If a step doesn't do what the AI said, tell it exactly what you see.

    Tip: do all this on a copy of the file. Save it as sales-cleaned.xlsx first, so the original is safe.
  3. Route B: Let the AI clean the file for you

    Faster, if your data is allowed to be uploaded (and the practice file always is). Attach the CSV file to the chat and send:

    Copy this prompt
    Please clean this spreadsheet and give me a cleaned CSV file to download.
    
    1. Remove rows that are exact duplicates, and tell me how many you removed.
    2. Convert every Order Date to a real date in the format YYYY-MM-DD. The dates are UK style (day/month/year), so 08/01/2026 means 8 January.
    3. Trim extra spaces from all text, and make Region consistent: North, South, East or West.
    4. Remove the "£" from Unit Price so it's a plain number.
    5. Change Sales Rep names written as "Surname, First" to "First Surname".
    6. Don't delete rows with a blank Quantity. List their Order IDs so I can check them.
    
    Then give me a short summary table of every change you made, with counts.

    AI assistants that can run code (Claude, ChatGPT and Copilot all can) will process the whole file and give you a download link. Open it in Excel.

    The dates warning. "08/01/2026" is 8 January in the UK and August 1 in the US. Always tell the AI which style your dates use, or it may guess wrong without telling you.
  4. Check the AI's work

    Never pass on a cleaned file without checking. These checks take two minutes:

    • Row count: the original had 314 rows. Did 14 go, leaving 300?
    • Spot check: pick three Order IDs and compare them in the old and new files.
    • Filter each text column: clicking the filter arrow on Region should show only North, South, East and West.
    • Sort by date: the oldest and newest dates should make sense.

    Or ask the AI to help:

    Copy this prompt
    Before I use this cleaned file, please double-check your own work: confirm the number of rows before and after, that every date is valid and within the range you'd expect, that Region has only the four values, and that no Order ID appears twice. Tell me about anything you're not sure of.
  5. Save the recipe for next time

    If this is a report you clean every week or month, ask the AI to turn the steps into something reusable:

    Copy this prompt
    I'll get a new version of this file every month with the same columns and the same problems. What's the quickest way to repeat this cleaning each time? Please explain the options for a beginner (saving these prompts, an Excel Power Query, or a small script) and recommend one.
ADVERTISEMENT · IN-ARTICLE
If it goes wrong

Quick fixes

Remove Duplicates removed too many rows

It compares only the columns you tick. If you only tick "Customer", it keeps one order per customer. Undo (Ctrl+Z) and make sure every column is ticked.

The dates are still left-aligned and won't sort

Excel is still treating them as text. Tell the AI: "My dates in column B are still text after your steps. Here are 5 examples: [paste]. Please give me a formula that converts all of these to real dates."

The AI's cleaned file has fewer rows than I expected

Ask it to "list every row you removed and why". Sometimes it treats near-duplicates as duplicates.

The upload won't work

Free plans sometimes limit file uploads or file sizes. Use Route A, or save the file as CSV, which is smaller and simpler for the AI.

Opening the cleaned CSV mangles the dates again

In Excel, use Data › From Text/CSV to import it instead of double-clicking, and set the date column's type there.

Try it on other jobs

Use it on your own work

Mailing lists

remove duplicate emails, fix capitals in names, flag invalid email addresses

Survey results

standardise "Yes / yes / Y / y" answers before counting them

Stock lists

merge product codes written as "AB-100", "ab100" and "AB 100"

Timesheets

turn "7.5", "7h30" and "7:30" into one consistent number of hours

System exports

strip the junk header rows and totals some systems add to their CSV exports

Why this way?

An afternoon of fiddly fixes in a few minutes

Clean data is the boring step everyone skips, and it's why reports don't add up. AI turns an afternoon of fiddly fixes into a few minutes. Route A also teaches you the Excel tricks as you go, so next time you'll know them yourself.

Keep going

What to build next