Clean and reshape imported spreadsheet data

8 steps · about 1 h 33 min · Intermediate

  1. Recognise a tidy table (article, Wikipedia, 12 min)

    Start with a clear target: one variable per column, one observation per row and one value per cell.

  2. Inspect delimiters before importing (article, Wikipedia, 10 min)

    Recognise separators, quoting and encoding choices before a malformed import spreads across the workbook.

  3. Assign deliberate data types (article, Wikipedia, 12 min)

    Distinguish text, numbers, dates and logical values so sorting and formulas behave predictably.

  4. Remove invisible spacing problems (article, Wikipedia, 8 min)

    Find leading, trailing and non-breaking spaces that make apparently equal labels compare differently.

  5. Split patterned text carefully (article, Wikipedia, 15 min)

    Use repeatable patterns to separate codes and labels while retaining the original column for comparison.

  6. Match related records conservatively (article, Wikipedia, 14 min)

    Understand why near-matching names need explicit rules and review instead of an aggressive automatic merge.

  7. Remove true duplicates (article, Wikipedia, 10 min)

    Choose a defensible key, inspect collisions and remove only rows that represent the same record.

  8. Validate and document the clean table (article, Wikipedia, 12 min)

    Check completeness, consistency and plausible ranges, then record transformations so the result can be reproduced.