The golden rules of cleaning#
- Never edit the original - copy the raw sheet (or keep the source file) so you can always start again.
- Clean in helper columns with formulas, check them, then paste as values if needed.
- Write down every step - you'll need to repeat it next month (or automate it with Power Query).
- Check counts before and after - rows, totals, unique values.
Data cleaning के 4 सुनहरे नियम:
- Original data को कभी न बदलें - पहले copy बनाएँ।
- Helper columns में formula से साफ़ करें, जाँचें, फिर values paste करें।
- हर कदम लिखकर रखें - अगले महीने यही दोहराना पड़ेगा (या Power Query से automatic करना)।
- पहले और बाद में गिनती मिलाएँ - कितनी rows थीं, कितनी बचीं, totals सही हैं या नहीं।
Open vindhya_mart_practice.xlsx → Raw_Data sheet. It has 312 rows with typical problems:
| Problem | Column | Example |
|---|---|---|
| Duplicate rows | all | the same order twice (12 duplicates) |
| Extra spaces & case | city | " Indore ", "INDORE", "indore" |
| Different spellings | city | Bangalore vs Bengaluru |
| Lower-case categories | segment | consumer vs Consumer |
| Mixed date formats | order_date | 2024-03-05, 05/03/2024, 05-03-2024, 05 Mar 2024 |
| Numbers as text | sales | Rs. 2,099.30 (88 rows) |
| Blanks | region, quantity | 10 blank regions, 10 blank quantities |
1. Remove duplicates#
Data → Remove Duplicates → keep all columns ticked (a row is a duplicate only if every column matches) → OK.
Excel reports how many were removed. Check: 312 rows → 300 unique rows (12 removed).
Choosing only order_id would also be valid here - but think first. In some datasets the same order ID legitimately appears on several rows (one per product). Define "duplicate" based on what one row represents.
To find duplicates without deleting: Conditional Formatting → Highlight Cells Rules → Duplicate Values (on the order_id column), or =COUNTIF($A$2:$A$313, A2)>1.
2. Fix spaces and text case#
| Function | Does | Example result |
|---|---|---|
=TRIM(A2) |
removes extra spaces | " Indore " → "Indore" |
=PROPER(A2) |
Title Case | "INDORE" → "Indore" |
=UPPER(A2) / =LOWER(A2) |
all caps / all small | |
=CLEAN(A2) |
removes non-printing characters (from web/PDF copies) | |
=LEN(A2) |
counts characters - reveals hidden spaces |
Combine them in a helper column next to city:
=PROPER(TRIM(D2))
Fill down, then copy → Paste Special → Values over the original column (or keep the helper column and delete the old one).
3. Standardise spellings#
After TRIM/PROPER, Bangalore and Bengaluru are still two "cities". Options:
- Find & Replace (Ctrl + H): Find
Bangalore→ ReplaceBengaluru→ Match entire cell contents. - For many variations, create a small mapping table (wrong → correct) and use XLOOKUP (next lessons) or Power Query's Replace Values.
Check with a filter: the city drop-down should now show exactly 19 cities.
4. Convert text to numbers#
The sales column has values like Rs. 2,099.30. Remove the text parts, then convert:
=VALUE(SUBSTITUTE(SUBSTITUTE(K2, "Rs. ", ""), ",", ""))
For cells that are already numbers this also works (SUBSTITUTE converts the number to text, VALUE converts back).
Other quick methods:
- Find & Replace
Rs.with nothing, then,with nothing → Excel converts automatically. - Text to Columns → Finish on a column of text-numbers forces conversion.
- Multiply by 1:
=K2*1(works when the text contains only digits).
5. Fix mixed date formats#
Dates arrive as text in different formats. Options:
- Text to Columns → Step 3 → Column data format: Date (DMY) → converts
05/03/2024and05-03-2024correctly. - DATEVALUE converts recognisable date text:
=DATEVALUE("05 Mar 2024"). - For full control, build the date from parts:
=DATE(RIGHT(B2,4), MID(B2,4,2), LEFT(B2,2)) ← for text like 05/03/2024
- Power Query handles mixed formats best - "Change Type with Locale → Date, English (India)". (Next-but-one lesson.)
Watch for DD/MM vs MM/DD confusion. 05/03/2024 is 5 March in India but 3 May in the US. Check a few dates manually after converting (e.g. a date like 25/03/2024 can only be DD/MM).
Verify: a correctly converted date is right-aligned and changes when you apply a different date format.
6. Handle blanks#
Find blanks: select the column → Home → Find & Select → Go To Special → Blanks.
Decide per column:
| Situation | Action |
|---|---|
| Can be derived from another column (region from city) | fill using a lookup or the known mapping |
| Critical and unknown (quantity) | flag the row, ask the data owner, or exclude it from calculations that need it |
| Not important for this analysis | leave it, but note it |
For region we know the mapping (Indore → Central, Delhi → North...), so we can fill it with XLOOKUP from a city-region table - you'll do exactly this in the Lookups lesson.
7. Split and combine columns#
- Text to Columns (Data tab): split
"Indore, Madhya Pradesh"by comma. - TEXTSPLIT (Excel 365):
=TEXTSPLIT(A2, ", "). - LEFT / RIGHT / MID / FIND:
=LEFT(A2, FIND(",", A2) - 1)→ text before the comma. - Combine:
=A2 & " - " & B2or=TEXTJOIN(", ", TRUE, A2:C2).
8. Flash Fill (Ctrl + E)#
Type the result you want for the first one or two rows - Excel guesses the pattern and fills the rest. Great for extracting first names, initials, codes from IDs.
order_id year (type this)
VM-2024-00147 → 2024
VM-2025-00811 → (press Ctrl+E - Excel fills 2025, 2024...)
Flash Fill gives values, not formulas - it won't update if the source changes. For repeatable work use formulas or Power Query.
Cleaning checklist#
- [ ] Copy of raw data saved
- [ ] Duplicates removed (count before/after noted)
- [ ] Text trimmed and case standardised
- [ ] Spellings standardised (check unique values with a filter)
- [ ] Numbers are numbers (right-aligned, SUM works)
- [ ] Dates are real dates (right-aligned, can change format)
- [ ] Blanks handled and documented
- [ ] Data converted to an Excel Table
Practice - clean the Raw_Data sheet#
Work through steps 1-6 on Raw_Data, then answer:
1. How many rows remain after removing exact duplicates?
300 rows (312 - 12 duplicates).
2. How many distinct cities remain after TRIM + PROPER + replacing Bangalore with Bengaluru?
19 cities (the same as the clean Sales sheet). Before cleaning, the city column had 92 different spellings!
3. How many sales values were stored as text with "Rs."?
88 values (in the original 312 rows) - after conversion, the sales column should SUM without errors.
4. How many rows have a blank region and how would you fill them?
10 rows in the original 312 (9 after removing duplicates). Fill them from the city using a city → region mapping table with XLOOKUP (next lessons), because every city belongs to exactly one region.
Summary#
- Keep the raw data; clean in helper columns; record every step; check counts.
- Remove Duplicates, TRIM, PROPER, Find & Replace fix most text problems.
- Convert text-numbers with SUBSTITUTE + VALUE; convert dates with Text to Columns, DATEVALUE or DATE.
- Handle blanks deliberately; split with Text to Columns/TEXTSPLIT; use Flash Fill for quick patterns.