toolrota

A guide to data cleaning in Excel: 12 steps to make messy data ready for analysis

The quality of analysis depends on the quality of data. Practical, step-by-step ways to clean extra spaces, duplicates, numbers stored as text and broken dates.

Serkan Akyürek··4 min read
A guide to data cleaning in Excel: 12 steps to make messy data ready for analysis – Excel

Before turning a table into a pivot table or chart, the most time-consuming job is data cleaning. Files from outside often contain extra spaces, repeated rows, numbers stored as text and dates in mixed formats. In this guide we make messy data ready for analysis in 12 steps.

0. Back up first and work on a copy

Cleaning makes changes that are hard to undo. Keep the raw data on a separate sheet as it is and clean a copy. Turning the data into a table with Ctrl + T makes the work easier (see our Excel tables guide).

1. Clean extra spaces

Invisible leading/trailing spaces break matching (VLOOKUP can't find).

=TRIM(A2)

TRIM removes leading and trailing spaces and reduces extra spaces between words to one. For non-printable characters such as line breaks use =CLEAN(A2). For the non-breaking space (from the web) add =SUBSTITUTE(A2,CHAR(160)," ").

2. Remove duplicate records

With Data > Remove Duplicates choose which columns define a duplicate. Before deleting, flag duplicates with conditional formatting and review them (see our remove duplicates guide).

3. Fix numbers stored as text

A green triangle in the top-left of the cell, or left-aligned content, suggests the number may be text.

  • Select the cell and use warning icon > Convert to Number.
  • Or type 1 in an empty cell and copy it, select the range and Paste Special > Multiply.
  • With a formula: =VALUE(A2).

If the decimal separator differs (point/comma), first fix it with SUBSTITUTE.

4. Standardise dates

Dates arriving in different formats can remain text. First check the cell format; if needed use Data > Text to Columns > Date. With a formula: =DATEVALUE(A2). Splitting year-month-day parts and rebuilding with =DATE(year,month,day) is also safe (see our date functions guide).

5. Fix letter case

FunctionResult
=UPPER(A2)ALL CAPS
=LOWER(A2)all lower
=PROPER(A2)Each Word Capitalised

With accented and special characters check the result.

6. Split and join text

If first and last name are in one cell use Flash Fill (Ctrl + E) or Text to Columns. To join, =A2&" "&B2 is enough (see our text splitting guide).

7. Bulk fixes with Find and Replace

Ctrl + H: bring variants such as "Ltd.", "Ltd", "LTD" to one form. You can use wildcards (* and ?). Before replacing, use "Find All" to see how many cells are affected.

8. Manage blank cells

Select all blanks with F5 > Special > Blanks. You can fill them with "Unknown," fill them with the value above (type =A2 and Ctrl + Enter) or delete the row. Think about why the blank exists; zero and missing data are not the same.

9. Find wrong and outlying values

  • Colour extreme values such as a negative age or a 1,000-year-old date with conditional formatting.
  • Look at the smallest/largest values in a filter.
  • For error values (#VALUE!, #N/A) find the source; instead of hiding them with IFERROR, fix the cause (see our Excel errors guide).

10. Build consistent categories

Link variants such as "New York," "new york," "NYC" to one list. Build a mapping table for the category and convert to the standard value with VLOOKUP (see our VLOOKUP guide). For new entries use a drop-down list (see our drop-down guide).

11. Repeatable cleaning with Power Query

If the same file arrives every month don't repeat the steps by hand. Bring it into Power Query with Data > From Table/Range; steps such as trim, change type and remove duplicates are recorded and re-applied on refresh (see our Power Query guide).

12. Validation and documentation

  1. Does the row count match before and after cleaning?
  2. Do totals match the source?
  3. Compare 20 sample rows by hand.
  4. Write the steps you took on a "Notes" sheet.

Quick reference table

ProblemFix
Extra spacesTRIM, CLEAN
DuplicatesRemove Duplicates
Number as textVALUE, Paste Special
Broken datesText to Columns
Case differencesUPPER, PROPER
Bulk fixesFind and Replace
Repetitive jobPower Query

Common mistakes

  1. Not backing up the raw data.
  2. Deleting the original column without converting formula results to values (#REF! error).
  3. Leaving merged cells; sorting and filtering break.
  4. Mistaking a blank for 0.
  5. Not documenting the cleaning.

Summary

TRIM for spaces, Remove Duplicates for repeats, VALUE for numbers, Text to Columns for dates, Power Query for automation: clean data is the first condition of reliable analysis.

Share
Published:
Author
Serkan Akyürek

Serkan Akyürek is the founder and author of toolrota; he writes step-by-step guides on Excel, AI, the cloud, personal finance and digital security.

Related guides

Excel
Excel4 min read

Forecasting in Excel: how to project sales with TREND, FORECAST and the Forecast Sheet

Excel's TREND, FORECAST and Forecast Sheet are enough to roughly project the future from past data. Setup, interpretation and ways to avoid misleading results.

Excel4 min read

Excel tips and tricks: 40 practical tips that speed up everyday work

If you use Excel every day, small tips save a lot of time. 40 practical tips from shortcuts to formula tricks, clean-up and security, with examples.

Excel5 min read

Building an invoice template in Excel: formulas, VAT, numbering and PDF output

A simple Excel template is a quick, tidy way for small businesses and freelancers to prepare invoices and quotes. Layout, formulas, automatic numbering and PDF steps.

Excel3 min read

How to build an inventory tracker in Excel: stock in/out, low-stock alerts and reports

Inventory tracking for a small business doesn't need expensive software. A product list, a movements table and a few formulas give live stock and low-stock alerts.

Excel4 min read

How to make a Gantt chart in Excel: two methods for a project timeline

Project tracking doesn't need expensive tools. In Excel you can draw a Gantt chart from a task table, with a stacked bar chart or with conditional formatting.

AI5 min read

Learning a language with AI: speaking practice, feedback and a weekly study plan

AI can work like an endlessly patient conversation partner. Prompt examples for role-play, feedback and vocabulary drills, a weekly plan and warnings about mistakes.