# How to Clean Data in a Spreadsheet: 8 Steps That Work

> Clean data in a spreadsheet with a repeatable routine: trim spaces, standardize dates, fix text and numbers, remove duplicates and check the result.

Source: https://www.stacwise.com/blog/clean-data-in-a-spreadsheet/
Updated: 2026-11-12

To clean data in a spreadsheet, work on a copy, trim stray spaces, fix text and number types, standardize dates, handle blanks, remove duplicates, and then check the result. Doing the steps in that order avoids the common trap of removing duplicates that only looked different because of an extra space.

Here is the routine, with formulas that work in most spreadsheet apps.

## Step 1: Copy the raw data

Never clean the only copy. Duplicate the sheet, name one Raw and the other Clean, and do all your work in Clean. If something goes wrong, you can compare against Raw or start over.

Then scan the data. Look at each column and ask what values should be allowed. Sorting a column from A to Z or filtering to see its unique values is a fast way to spot oddities like typos, empty cells and stray symbols.

## Step 2: Trim spaces and hidden characters

Extra spaces cause lookups and duplicate checks to fail silently. The values Ana and Ana with a trailing space look the same but are different to the spreadsheet.

```
=TRIM(A2)
```

`TRIM` removes leading and trailing spaces and collapses repeated spaces inside the text. For non-breaking spaces from copied web content, which TRIM may not remove, substitute them first:

```
=TRIM(SUBSTITUTE(A2,CHAR(160)," "))
```

`CLEAN` removes non-printing characters. Wrap it around the formula if text looks odd: `=TRIM(CLEAN(A2))`. Fill the formula down a helper column, then copy the results and paste them as values over the originals.

## Step 3: Make text consistent

Names and categories often differ in capitalization or wording. Pick one style.

| Raw | Formula | Result |
|---|---|---|
| north | `=PROPER(A2)` | North |
| SALES | `=PROPER(A3)` | Sales |
| acme inc | `=UPPER(A4)` | ACME INC |

For different spellings of the same thing, such as NY, N.Y. and New York, use find and replace, or `SUBSTITUTE`:

```
=SUBSTITUTE(A2,"N.Y.","New York")
```

Better still, use a dropdown list for that column in future so the problem does not return.

## Step 4: Fix numbers stored as text

If a column will not add up, its numbers may be text. Common signs are left-aligned digits, a small warning mark in the cell, or a SUM that returns zero. To convert:

```
=VALUE(A2)
```

If the text contains a currency symbol or thousands separators, strip them first:

```
=VALUE(SUBSTITUTE(SUBSTITUTE(A2,"$",""),",",""))
```

Then format the column as a number with a fixed number of decimals.

## Step 5: Standardize dates

Dates are the most common source of silent errors. A text value like 03/04/2026 can mean 3 April or 4 March depending on region, so the first job is to know which your source uses.

- If the cells are real dates, just apply one display format to the column, such as year-month-day, which is unambiguous.
- If they are text, rebuild them from parts. For text in the form 2026-03-04:

```
=DATE(LEFT(A2,4), MID(A2,6,2), RIGHT(A2,2))
```

- For text such as 04/03/2026 known to be day first, swap the pieces:

```
=DATE(RIGHT(A2,4), MID(A2,4,2), LEFT(A2,2))
```

Check by sorting: a correctly converted column sorts in true time order. Use `TEXT(A2,"yyyy-mm-dd")` only when you need a display string, because its result is text.

## Step 6: Handle blanks and errors

Decide what a blank means. Sometimes it should be zero, sometimes unknown, sometimes a row to delete. Filter the column to show blanks and handle each case on purpose.

```
=IF(A2="","Unknown",A2)
```

For error values like `#N/A` or `#DIV/0!`, find the cause first. If an error is legitimate, wrap the formula in `IFERROR`, but avoid using it to hide mistakes.

## Step 7: Remove duplicates

Only now are duplicates reliable to find. Decide which columns define a duplicate. For contacts, it might be the email column alone. For orders, it might be the order number.

A safe approach is to flag first, then remove:

```
=COUNTIF($A$2:A2, A2)
```

Fill this down next to your key column. The first occurrence shows 1, the second shows 2, and so on. Filter for values above 1 to review the repeats. Once you agree they are real duplicates, delete those rows. Most spreadsheet apps also have a built-in remove duplicates command that lets you choose which columns to compare.

Keep the first occurrence only if it is the most complete or most recent. If not, sort so the best row comes first before removing the rest.

## Step 8: Check your work

Finish with a quick audit:

- Count rows before and after, and be able to explain the difference.
- Check totals of key number columns against Raw.
- Sort and filter each column once more for odd values.
- Look for unexpected minimum and maximum values using `MIN` and `MAX`.
- Add a short note on the sheet listing what you changed.

Clean data is easier to summarize afterward, for example with [pivot tables for beginners](/blog/pivot-tables-for-beginners/), and to keep clean with the habits in [spreadsheet best practices](/blog/spreadsheet-best-practices/). If you work in [Workbook](/products/workbook/), the same text, date and counting functions apply.

## Key takeaways

- Work on a copy and look at the data before changing it.
- Trim spaces and make text consistent before you look for duplicates.
- Convert text numbers and text dates into real numbers and real dates, then apply one format.
- Flag duplicates with COUNTIF before deleting, and review them.
- Finish with row counts and totals so you know nothing was lost by accident.

## Frequently asked questions

### What is the first step in cleaning data?

Make a copy of the raw data and work on the copy. Then look at it before changing anything, scanning each column for blanks, odd values and inconsistent formats.

### How do I remove duplicates without losing data I need?

First decide what makes a row a duplicate, such as the same email address. Sort or flag the matches, review them, and then remove. Always keep the original sheet so you can recover a row removed by mistake.

### Why are my dates not sorting correctly?

They are probably stored as text, so the spreadsheet sorts them alphabetically. Convert them to real dates, then format the column consistently. A real date aligns to the right by default in most apps, while text aligns to the left.

### Should I use formulas or the built-in cleanup tools?

Built-in tools are quick for one-off fixes. Formulas are better when the data will be refreshed, because the cleanup repeats automatically on new rows.

