To clean data in an Excel spreadsheet, work through it in layers: make a backup copy first, then find and remove duplicates, trim stray spaces with TRIM and CLEAN, standardise text case and number formats with Find & Replace and Text to Columns, fix dates by splitting and rejoining them, and finally convert the tidy block into an Excel Table so filters and future imports behave predictably. Done in that order, each step makes the next one easier, because formulas, filters and sort orders all misbehave when hidden spaces, merged cells and mixed data types are still in place. Cleaning before you analyse saves far more time than correcting a report after the fact. Note that Excel labels and menu paths differ slightly between versions (Microsoft 365, Excel 2021, Excel for Mac) and by region, so if a button name looks different, look for the equivalent option in the same tab.
What You'll Need
- A copy of your workbook. Never clean the only version of important data: use File > Save As to create a working copy, or keep the raw sheet untouched and clean on a second sheet.
- Excel on desktop (Windows or Mac). Most cleaning tools described here are also in Excel for the web, but some, such as Text to Columns, are limited or missing there.
- An idea of what each column should contain: text, whole numbers, dates, or a fixed list of categories. You cannot clean data you have not defined.
- Optional: the Power Query editor (Data > Get & Transform Data) if you will repeat this cleaning on a new export every week.
Step-by-Step
- Make a copy and freeze the raw data. Rename the original sheet something like "Raw" and leave it alone. Do all cleaning on a duplicate sheet. If a formula later breaks something, you can start over without asking anyone for the file again.
- Remove blank rows and columns inside the data block. Select the whole data range, then use Home > Find & Select > Go To Special > Blanks to highlight empty cells. For whole empty rows, filter a key column for (Blanks) and delete the visible rows, not the entire sheet row, so neighbouring data stays intact. Do not delete rows manually one at a time; it is the slowest and most error-prone method.
- Trim hidden spaces and non-printing characters. Extra spaces are the number one cause of failed lookups and duplicate matches. In a helper column, type
=TRIM(A2)to strip leading, trailing and repeated internal spaces, and=CLEAN(A2)to remove non-printing characters that come from exports. Combine them as=TRIM(CLEAN(A2)), fill down, then copy the results and use Paste Special > Values over the original column before deleting the helper column. - Standardise text case. Names entered as "JOHN SMITH", "john smith" and "John Smith" are three different values to Excel. Use
=PROPER(A2)for names and titles,=UPPER(A2)for codes, or=LOWER(A2)for email addresses. Convert to values as in the previous step so the formulas do not depend on the original column. - Remove duplicates, but decide the rule first. Select the data and use Data > Remove Duplicates. Choose which columns define a duplicate: a customer ID alone is usually right, whereas name and address together can wrongly merge two people who share a name. Excel keeps the first occurrence and deletes the rest, so sort the sheet first if you need to preserve the most recent or most complete record. Copy duplicates to another sheet for checking before you confirm if the data matters.
- Split combined columns with Text to Columns. If one column holds "City, State ZIP" or a full name, select it and use Data > Text to Columns. Choose Delimited if a comma, semicolon or tab separates the parts, or Fixed width if the columns line up by character position. On the final screen, set the destination cell so the split output lands in empty columns and does not overwrite anything.
- Fix numbers stored as text. Left-aligned numbers with a green warning triangle are text. Select the range, click the warning icon and choose Convert to Number. If that option is missing, use Data > Text to Columns and simply click Finish, which reinterprets the column. Watch for decimal commas, currency symbols and thousands separators: remove them with Find & Replace before converting, or Excel will treat entries as text or read 1,234 as one point two three four.
- Repair dates. Imported dates often arrive as text in a month/day order that Excel misreads. Use Data > Text to Columns with the Column Data Format set to Date and pick the correct source order (MDY, DMY or YMD). After conversion, apply a single date format to the whole column so every cell displays consistently.
- Remove extra spaces around words with Find & Replace, cautiously. Find & Replace can standardise category labels quickly: replace "NY" with "New York" and "N.Y." with "New York". Turn on Match entire cell contents when you replace short codes, otherwise you will change fragments inside longer words.
- Fill missing values deliberately. Use Home > Find & Select > Go To Special > Blanks to jump to gaps. Either fill down from the value above (fine when the blank genuinely means "same as above", as in grouped category rows) or mark them as "Unknown". Never silently leave blanks in a column you will filter or sum, and never guess numeric values.
- Validate what is left. Add Data Validation (Data > Data Validation) with a list for category columns so future entries cannot break your clean set. Then check row counts before and after cleaning, and spot-check a sample of records to confirm nothing was lost or merged wrongly.
- Convert to a Table and save. Select the clean range and press Ctrl+T (Cmd+T on Mac) to create a Table. This gives you filters, structured references and automatic range growth. Save the workbook, and if the source is a recurring export, record the same steps in Power Query so the next file cleans itself.
Common Mistakes
- Deleting the raw data. Cleaning directly on the only copy makes every mistake permanent and untraceable.
- Deleting entire rows to remove blanks. This wipes data in adjacent columns that were not part of the selection. Delete whole rows only when the entire row is empty.
- Overwriting originals with formulas. Copying a TRIM result and pasting it with formatting over the source can leave formulas referencing themselves or produce errors. Always paste as Values.
- Removing duplicates on the wrong columns. The wrong key silently deletes valid records. Keep a copy of what was removed.
- Ignoring hidden spaces. VLOOKUP and XLOOKUP return "not found" because "Smith" and "Smith " are different strings. Trim before matching.
- Treating merged cells as clean. Merged cells break sorting, filtering and pivots. Unmerge and fill the values down instead.
Tips
- Clean in a fixed order: structure first, then text, then numbers and dates, then duplicates. Each step depends on the previous one.
- Keep a "log" column noting how each row was changed, or use a separate change notes sheet, so someone reviewing the data can see what happened.
- Use conditional formatting to colour duplicate values or blanks before deciding what to delete.
- Learn one formula block well:
=TRIM(CLEAN(PROPER(A2)))handles most messy text imports in one pass. - For repeated exports, build the cleanup once in Power Query, then just refresh. It is more reliable than repeating manual steps.
- Save a version before every destructive step, so you always have a point to return to.
Troubleshooting
Formulas show errors or all results look wrong after cleaning. Check whether you pasted values over a column that other formulas referenced. Undo (Ctrl+Z) and paste into a new column instead.
TRIM does not remove the spaces. The characters are likely non-breaking spaces from a web export. Combine TRIM with CLEAN, or use Find & Replace, paste a non-breaking space into the Find box, and replace with a normal space, then trim again.
Numbers will not sum. They are still text. Look for the green triangle, convert to number, and check for stray characters. One text value makes an entire SUM return zero.
Dates flip day and month. Re-run Text to Columns with the correct source date order. Do not fix them one by one; a single wrong order will recur on the next import.
Remove Duplicates deletes too much. Undo immediately, restore from your backup, and add more columns to the duplicate key or add an ID column.
Excel is slow or freezes. Cleaning on huge ranges with conditional formatting can be heavy. Work in chunks or move the job to Power Query, which handles large files more efficiently.
Frequently Asked Questions
What does TRIM actually remove?
TRIM removes leading and trailing spaces and collapses multiple spaces between words into one. It does not remove non-printing characters or non-breaking spaces, which is why CLEAN is used alongside it.
Should I clean with formulas or manually?
Use formulas for anything repetitive, such as trimming spaces or standardising case, and use manual edits only for one-off fixes. Formulas are quicker and leave a record of what changed.
How do I clean the same type of file every week?
Use Power Query under Data > Get & Transform Data. Build the cleaning steps once, then point it at each new file and refresh. The steps run automatically and consistently.
Does Remove Duplicates keep the row I want?
It keeps the first occurrence in the current order. Sort the sheet so the row you want to keep appears first, then remove duplicates.
Can I clean data in Excel for the web?
Yes, for many tasks, but some tools such as Text to Columns are limited or unavailable in the browser version. Use the desktop app for the full set of cleaning features.
How do I know the cleaned data is correct?
Compare record counts before and after, check that totals match an independent source, and spot-check a sample of rows. Keep the raw sheet until you are confident.