Skip to content
Spreadsheets (Excel & Google Sheets)

Cleaning Up Messy Spreadsheet Data

20 min read Training Guide

Find and fix duplicates, stray spaces, combined fields, numbers and dates stored as text, and lost leading zeros before the data goes into a report, lookup or mailing.

Table of contents

Data rarely arrives clean. An export from another system, a list three coworkers typed by hand, or a file someone emailed you will have extra spaces, the same customer entered twice, names and cities crammed into one cell, and dates the spreadsheet does not recognize as dates. Each problem breaks something later: a lookup returns #N/A, a total comes up short, or a mailing goes out twice to the same person. This guide shows how to spot each problem and fix it in Excel and Google Sheets, without losing the original data.

What You Will Be Able to Do

  • Protect the original data and clean a working copy.
  • Spot hidden problems with a few quick checks.
  • Remove extra spaces, fix text case, and split or join columns.
  • Find and remove duplicate records without deleting the wrong ones.
  • Turn numbers and dates stored as text into real numbers and dates, and keep leading zeros.

Keep the Original

Cleanup tools change data in place, and some of them, like Remove Duplicates, delete rows for good once you save. Before you start:

  1. Copy the sheet. Right-click its tab and choose Duplicate in Google Sheets, or Move or Copy (with Create a copy checked) in Excel. Rename the copy "Working" and leave the original alone.
  2. Do formula fixes in helper columns next to the data, such as a TRIM column beside a name column.
  3. When a helper column is right, copy it and paste it back as values only. In Excel, use Paste Special > Values (Ctrl+Alt+V, then V). In Google Sheets, press Ctrl+Shift+V. Then delete the helper column.

Pasting values replaces the formulas with their results, so the cleaned data no longer depends on the messy column you are about to delete.

Run a Few Quick Checks

Check How What it tells you
Alignment Look at a number or date column with no alignment set Entries on the left are stored as text
ISNUMBER =ISNUMBER(B2) FALSE in a number column means text
LEN =LEN(A2) A count higher than the visible characters means hidden spaces
Filter list Turn on a filter and open a column's drop-down Variants like "Acme", "ACME Inc" and "Acme " show up side by side
COUNTIF =COUNTIF($B$2:$B$500,B2) Anything over 1 appears more than once
Sort Sort a copy and look at the top and bottom Blanks, odd entries and stray symbols collect at the ends

The filter drop-down is the fastest of these. It lists every distinct value in a column, so misspellings and near-duplicates stand out.

Remove Extra Spaces

Extra spaces are invisible and break lookups, sorts and duplicate checks. "Maria Lopez " with a trailing space has 12 characters, so =LEN(A2) returns 12 instead of 11, and it will not match "Maria Lopez".

  • TRIM, in both programs. =TRIM(A2) removes spaces at the start and end and squeezes runs of spaces between words down to one.
  • Google Sheets menu. Select the cells and choose Data > Data cleanup > Trim whitespace. It fixes the cells in place.
  • Non-breaking spaces. Text copied from web pages and some emails can hold a non-breaking space (character 160). TRIM and Trim whitespace do not remove it. Swap it for a normal space first, then trim: =TRIM(SUBSTITUTE(A2,CHAR(160)," ")).
  • Line breaks and other hidden characters. =CLEAN(A2) removes characters that do not print, such as line breaks inside a cell.

Fix Text Case

Function Turns "mARIA lOPEZ" into
=PROPER(A2) Maria Lopez
=UPPER(A2) MARIA LOPEZ
=LOWER(A2) maria lopez

PROPER capitalizes the first letter of each word, and any letter that follows a character that is not a letter, and lowercases the rest. That breaks some names and codes. "McDonald" becomes "Mcdonald", and a part code like "ab-12c" becomes "Ab-12C". Run PROPER on names, then scan the results before you paste them back. Leave codes and IDs alone.

Split One Column into Several

An export may put a whole name, or a city, state and ZIP, in one cell. You can split it at a separator, such as a comma.

Warning: Splitting writes the new pieces into the columns to the right and overwrites whatever is there. Insert enough empty columns first.

Excel: Select the column, then choose Data > Text to Columns.

  1. Choose Delimited when a character such as a comma separates the pieces, or Fixed width when each piece starts at the same position.
  2. Check the delimiter, such as Comma. Watch the Data preview.
  3. On the last step, set a column's format to Text if it holds IDs or ZIP codes, so the leading zeros stay. You can also choose Do not import column to skip a piece.
  4. Set the Destination, then click Finish.

Google Sheets: Select the column, then choose Data > Split text to columns. A Separator box appears near the data. Leave it on Detect automatically, or pick the separator, such as Comma or Space, or type a custom one.

Formulas. To split without changing the original column, use =SPLIT(A2,",") in Google Sheets or =TEXTSPLIT(A2,",") in Excel for Microsoft 365 or Excel 2024.

Worked example: "Lopez, Maria" split at the comma gives "Lopez" and " Maria", with a space in front of Maria. Run TRIM on the second column. Do not split names at spaces. "De La Cruz, Ana" would land in four columns.

Joining columns works the other way. =B2&" "&A2 turns "Maria" in B2 and "Lopez" in A2 into "Maria Lopez".

Pattern fill. Excel's Flash Fill (Ctrl+E) and Google Sheets' Smart Fill (Ctrl+Shift+Y) can finish a column from a few examples you type, such as first names pulled from full names. Check every row. The results are plain values and do not update when the source changes.

Find and Remove Duplicates

First decide what makes two rows the same record. Two rows with the same name might be two different people. Two rows with the same account number or phone number usually are one record. Pick the column, or set of columns, that identifies a record.

A B C
1 Name Phone City
2 Maria Lopez 937-555-0142 Dayton
3 Sam Ortiz 937-555-0187 Kettering
4 MARIA LOPEZ (937) 555-0142 Dayton
5 Dee Park 937-555-0110 Xenia
6 Sam Ortiz 937-555-0187 Kettering

Rows 3 and 6 match exactly. Rows 2 and 4 are the same person, but the phone is written two ways, so a duplicate check will not catch them. Make the format the same first. Here, use Find and Replace (Ctrl+H in both programs) to replace "(" with nothing, then ") " with "-". Now row 4 reads 937-555-0142.

Highlight duplicates before you delete anything.

  • Excel: Select the Phone column, then choose Home > Conditional Formatting > Highlight Cells Rules > Duplicate Values.
  • Google Sheets: Select B2:B6, choose Format > Conditional formatting, set Format cells if to Custom formula is, and enter =COUNTIF($B$2:$B$6,B2)>1.

Look at every highlighted pair and decide which row to keep. Sort so the row you want to keep, such as the newest or most complete, comes first, because both tools keep the first row they find and remove the later ones.

Remove them.

  • Excel: Click in the data, choose Data > Remove Duplicates, check My data has headers, and check only the columns that define a duplicate, here Phone. Click OK. Excel reports how many rows it removed.
  • Google Sheets: Select the data, choose Data > Data cleanup > Remove duplicates, check Data has header row, choose the columns to compare, and click Remove duplicates.

Both tools ignore letter case, so "MARIA LOPEZ" and "Maria Lopez" count as the same. Neither ignores spaces, which is why you trim first. In the example, removing duplicates by Phone leaves rows 2, 3 and 5.

Turn Text into Real Numbers

Numbers stored as text look right, but math skips them. A column holding 50, the text "120" and 100 gives =SUM(B2:B4) = 150, not 270, with no error at all.

Signs of text numbers: they sit on the left of the cell, ISNUMBER returns FALSE, and in Excel a small green triangle appears in the cell's corner.

  • Excel: Select the cells, click the warning icon that appears beside them, and choose Convert to Number. Or run Data > Text to Columns on the column and click Finish right away.
  • Either program: In a helper column, use =VALUE(B2), then paste the results back as values.
  • Strip symbols first. Exports sometimes add text such as "USD" or extra characters. Remove them with Find and Replace, then convert.

Turn Text into Real Dates

Text dates cannot be sorted in date order, subtracted or grouped by month. "1/10/2026" sorts before "1/2/2026" because text sorts one character at a time.

Signs of text dates: they sit on the left, they sort wrong, and a filter lists them as plain values instead of by year and month.

  • DATEVALUE, in both programs. =DATEVALUE(A2) turns text in a recognized date format into a date serial number. Format the result as a date. If it shows a number such as 46095, the value is right and only needs a date format, which displays it as 3/14/2026.
  • Excel's Text to Columns. On the last step, choose Date and pick the order the text uses, such as MDY or DMY.
  • Dates written as 8 digits, such as 20260314. Build the date from its pieces: =DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2)) returns 3/14/2026. The DATE function takes the year, month and day, in that order, in both programs.

Warning: Watch the day and month order. 03/04/2026 is March 4 in the United States and 3 April in many other countries. Find a date with a day over 12, such as 13/04/2026, to learn which order a file uses. In Google Sheets, the spreadsheet's locale under File > Settings decides how typed and converted dates are read.

Keep Leading Zeros

ZIP codes, employee IDs and part numbers often start with 0. When a program reads 02134 as a number, it becomes 2134.

  • Before you type or paste: Format the column as text. In Excel, use Home > Number Format > Text. In Google Sheets, use Format > Number > Plain text.
  • When opening a CSV: Excel for Microsoft 365 can stop removing leading zeros. Look under File > Options > Data > Automatic Data Conversion. When importing into Google Sheets with File > Import, turn off the option to convert text to numbers and dates if it appears.
  • After the zeros are gone: Rebuild them as text. For 5-digit ZIP codes, =TEXT(A2,"00000") turns 2134 back into "02134". Only use this when you know every value has the same number of digits.

A Cleanup Order That Works

  1. Copy the original sheet and work on the copy.
  2. Run the quick checks and note what you find.
  3. Trim spaces and remove hidden characters.
  4. Split combined columns, and make formats the same, such as phone numbers.
  5. Convert text numbers and text dates.
  6. Fix leading zeros.
  7. Highlight duplicates, decide which rows to keep, then remove them.
  8. Paste helper columns back as values and delete the helpers.
  9. Recount the rows, and check one or two totals against the original.

Duplicates come last because spaces, case and formats hide them until the rest is clean.

Prevent the next mess. A drop-down list stops people from typing ten versions of the same value. In Excel, choose Data > Data Validation and set Allow to List. In Google Sheets, choose Data > Data validation, add a rule, and choose Dropdown.

Common Mistakes

Mistake What it costs
Cleaning the only copy No way back after a bad Remove Duplicates
Removing duplicates before trimming Duplicates with a stray space stay in the list
Treating same-name rows as duplicates Deleting a real, different customer
Splitting into columns that hold data The data to the right is overwritten
Leaving helper formulas in place, then deleting the source Every cleaned cell turns into #REF!
Guessing the day and month order Dates moved to the wrong month

Check Your Understanding

1. You remove duplicates from a vendor list, but "Coastal Print" still appears twice. Both look the same. What do you check?

Check each with LEN. One likely has a trailing space or a non-breaking space. Clean the column with TRIM, using SUBSTITUTE for character 160 if needed, then remove duplicates again.

2. A column of order totals sums to less than you can add up by eye, and some totals sit on the left side of their cells. What happened, and how do you fix it?

Those totals are stored as text, so SUM skips them. Convert them with Convert to Number in Excel, or with =VALUE() in a helper column pasted back as values, then check the total again.

3. An export gives dates as 20260905. What formula turns A2 into a real date, and what date is it?

=DATE(LEFT(A2,4),MID(A2,5,2),RIGHT(A2,2)), which returns September 5, 2026. Format the cell as a date.

4. A client list has two rows for "J. Smith" with different phone numbers and addresses. Should you remove one?

No, not without checking. Same name with different details may be two different people. Confirm with the account record or your supervisor before you merge or delete.

5. You split a "City, ST ZIP" column, and the ZIP for Boston came out as 2134. How do you prevent that next time?

In Excel's Text to Columns, set the ZIP column's format to Text on the last step. In Google Sheets, format the destination column as Plain text before you split.

Key Takeaways

  • Clean a copy, use helper columns, and paste values when each fix is right.
  • LEN, ISNUMBER and the filter drop-down find most hidden problems in seconds.
  • Trim spaces and make formats the same before you look for duplicates.
  • Decide what makes a record a duplicate before you delete anything.
  • Text numbers and text dates sit on the left and break math, sorting and grouping.
  • Check the day and month order of any imported dates, and protect leading zeros with a text format.