Dirty Data Cost
Data Cleaning and Quality in Data Analytics
The Cost and Causes of Dirty Data
Inaccurate or bad data costs businesses $3.1 trillion per year in the United States alone, according to IBM. The number one cause of poor quality data is human error — not system implementations or technical glitches. Common human errors include typing data incorrectly, inconsistent formatting, leaving fields blank, or entering the same data more than once (creating duplicates). These small mistakes accumulate and can lead to major consequences for organizations.
Definitions: Dirty vs Clean Data
Dirty data is data that is incomplete, incorrect, or irrelevant to the problem you are trying to solve. It cannot be used in a meaningful way and makes analysis difficult or impossible.
Clean data is data that is complete, correct, and relevant to the problem you are trying to solve. It allows analysts to understand information, identify patterns, connect related data, draw useful conclusions, and make effective decisions.
Data integrity — the overall accuracy, consistency, and reliability of data — depends on clean data. Working with clean data makes projects go more smoothly and yields trustworthy results.
Roles That Support Clean Data
Role | Responsibility |
|---|---|
Data engineers | Transform data into a useful format for analysis, develop and maintain databases and data processors, provide reliable infrastructure |
Data warehousing specialists | Develop processes to store and organize data effectively, ensure data is available, secure, and backed up to prevent loss |
When data passes through these professionals first, analysts can be confident they are starting with higher-quality data. However, no data set is perfect — analysts should always examine and clean data before beginning analysis.
Internal vs External Data
Internal data (from company sources, verified by engineers) is more likely to be clean but still has issues. For example, a single user may have multiple usernames, creating duplicates that must be removed.
External data and data from multiple sources require even more cleaning because formats, structures, and standards often differ.
Understanding Nulls
A null indicates that a value does not exist in a data set — it is not the same as zero. In survey data, a null means the respondent skipped a question, while a zero means they provided zero as a response. Analysts must decide how to handle nulls: filter them out (reducing sample size) or keep them and investigate why responses were missing (e.g., poorly written questions, confusion, bias).
Common Types of Dirty Data
Spelling and Text Errors
Misspellings, spelling variations, mixed-up letters, inconsistent punctuation, and typos in general.
Different currencies (e.g., US dollars and euros) can be mixed up if not properly handled.
Inconsistent Formatting
Data that should appear in one format (e.g., currency) is displayed in another (e.g., percentage). This makes the information unusable until corrected.
Missing Data (Nulls)
Empty fields require research to fill in the correct information. This type of dirty data demands more effort than fixing a typo.
Duplicates
Occur when the same data is entered more than once, either by different people or accidentally (e.g., copy-paste). Duplicates cause incorrect aggregations (e.g., counting a 500membershiptwiceas1000).
Labeling Errors
Incorrect labels confuse analysis. For example, training a computer to recognize pandas requires thousands of correctly labeled images; one mislabeled image can cause errors.
Inconsistent Field Length
Field length determines how many characters can be entered into a field. Assigning a fixed length (e.g., four digits for birth year) helps avoid errors.
Data validation is a tool that checks the accuracy and quality of data before adding or importing it, including enforcing field lengths.
Data Cleaning Techniques
Before removing any data, always make a copy of the data set so you can recover anything deleted by mistake.
Removing Unwanted Data
Duplicates — Delete duplicate rows manually or use spreadsheet tools (e.g., Remove Duplicates). This is critical when combining data from multiple sources.
Irrelevant data — Data that does not fit the problem (e.g., non-current members in a project focused on current members) must be removed. This requires careful judgment.
Extra spaces and blanks — Extra spaces cause unexpected results in sorting, filtering, and searching. Use spreadsheet functions to remove leading, trailing, and repeated spaces.
Formatting inconsistencies — Different sources use different formatting. Use Clear Formats to create a clean, consistent visual appearance.
Typos and capitalization — Fix misspellings, incorrect punctuation, and inconsistent capitalization using Spell Check, Autocorrect, conditional formatting, and case-conversion tools (lowercase, uppercase, proper case).
Fixing Text and Formatting
Split Text to Columns — Divides a text string around a specified delimiter (e.g., comma) and puts each fragment into a separate cell. Also fixes numbers stored as text.
Concatenate — Joins multiple text strings into one string:
=CONCATENATE(text1, text2, ...).
Merging Data Sets
Data merging is the process of combining two or more data sets into a single set. This is common after organizational mergers, but analysts merge data for many reasons (e.g., to understand customer purchase patterns).
Challenges in Merging
Different structures (e.g., one organization uses a separate column for suite/apt number, another combines it with street address).
Different identifier types (e.g., member ID is a number in one set and an email address in another).
Different category names (e.g., "young professional" vs "student associate" for the same membership type).
Duplicate members appearing across both data sets.
Key Questions Before Merging
Do I have all the data I need?
Does the data I need exist within these data sets? (Consider the schema, relevance, and cleanliness.)
Do the data sets need cleaning, or are they ready to use?
Are the data sets cleaned to the same standard? (Check repeated fields, missing value handling, recency of updates.)
Analysts can use spreadsheet tools, SQL queries, or programming languages like R to clean, merge, and prepare data for analysis.
Spreadsheet Tools for Data Cleaning
Conditional Formatting
Changes how cells appear when values meet (or fail to meet) specific conditions.
Example: highlight all blank cells in pink to quickly identify missing information.
Remove Duplicates
Automatically finds and eliminates duplicate rows from a spreadsheet.
Always confirm that the data has a header row before using.
Format Dates Consistently
Select the date column, then Format > Number > Date to standardize date formats.
Split Text to Columns
Divides text around a delimiter (e.g., comma) into separate cells.
Also resolves the issue of numbers stored as text (e.g., "707" stored as text cannot be used in calculations until split).
Concatenate
Combines text strings. Useful for merging columns (e.g., joining street address and apartment number into one field).
Functions for Data Cleaning
COUNTIF
Counts the number of cells that match a specified value.
Syntax:
=COUNTIF(range, "criteria")Example:
=COUNTIF(I2:I72, "<100")reveals any membership dues below $100 (negative number or typo).
LEN
Returns the number of characters in a text string.
Syntax:
=LEN(text)Example: verify that all member ID codes are exactly 6 digits long.
LEFT and RIGHT
LEFT: returns a specified number of characters from the left side of a text string.
RIGHT: returns a specified number of characters from the right side.
Syntax:
=LEFT(text, num_chars),=RIGHT(text, num_chars)Example: extract the 5-digit numeric code from a product code that also includes a 4-character text identifier.
MID
Returns a segment from the middle of a text string.
Syntax:
=MID(text, start_num, num_chars)Example: extract the 2-character state abbreviation from a client code like "NYC012" (city, state, identifier).
TRIM
Removes leading, trailing, and repeated spaces in data.
Syntax:
=TRIM(text)Essential after importing data to avoid search and sorting problems.
Viewing Data for Cleaning
Sorting and Filtering
Sorting: arrange data alphabetically or numerically to bring duplicates close together and identify errors quickly.
Filtering: show only rows that meet specific criteria (e.g., values above a threshold), hiding the rest. This narrows focus for cleaning.
Pivot Tables
A data summarization tool that sorts, reorganizes, groups, counts, totals, or averages data. In cleaning, pivot tables provide a clutter-free view to identify patterns or anomalies.
Example: Create a pivot table showing total profits per product; filter for products earning at least $10,000 to focus on the most profitable items.
VLOOKUP (Vertical Lookup)
Searches for a value in the leftmost column of a range and returns a corresponding value from a specified column.
Syntax:
=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])Use
FALSEfor an exact match. Lock references with$to keep ranges fixed.Example: Given a product code, retrieve the product name from another sheet.
Plotting
Creating a chart (e.g., column chart) from data helps visually identify outliers or skewed values.
Example: A column chart of product prices quickly reveals a value that is too low (e.g., 0.73insteadof7.30 due to a misplaced decimal).
Data Mapping
Data mapping is the process of matching fields from one database to another, ensuring that data moved between systems remains compatible and consistent. It is crucial for data migration, integration, and mergers.
Steps in Data Mapping
Identify what data needs to be moved — Determine the tables and fields involved.
Define the desired format at the destination (e.g., numbers vs email addresses for member IDs).
Map the data — Analyze schemas, primary keys (unique column values), and foreign keys (fields referencing primary keys in other tables). For complex projects, use data mapping software that automatically cleans, matches, inspects, and validates data.
Transform data into a consistent format — For example, use CONCATENATE to combine street address and apartment number into one field.
Transfer the data — Methods include querying, import wizards, and drag-and-drop.
Test the mapping — Inspect a sample of data, spot-check for nulls, use conditional formatting, COUNTIF, sorting, and filtering to verify correctness.
Proper data mapping prevents errors from propagating through an organization and ensures that merged data sets are ready for reliable analysis.

Ask anything
We've read this whole study set, so questions about it get the best answers.