Mini-Project 3: Sanitizing 50,000 Messy KYC & GSTIN Records
Overview & Learning Objectives
In this capstone project for Week 3, you will build an automated data sanitization pipeline that cleans 1,000 messy vendor master records containing invalid phone numbers, lowercase GSTINs with accidental spaces, and scrambled names.
- Validate and clean 15-digit Indian GSTIN tax IDs using TRIM, UPPER, and LEN.
- Split messy contact names into First Name and Last Name using dynamic text slicing.
- Standardize phone numbers into clean 10-digit formats and flag invalid entries.
Industry Standard
Standard: Enterprise ERP systems (SAP, Oracle) reject data imports with formatting errors. Data analysts must build sanitization templates to audit master data before migration.
Real-World Example: Vendor Master KYC & GSTIN Sanitization Pipeline
Your procurement team receives vendor onboarding registrations from Google Forms. Vendors enter GSTINs in lowercase with spaces (`" 27aabcl1234f1z5 "`) and messy phone numbers (`"098765-43210"`). You will build a 1-click clean view.
| Raw Vendor GSTIN | TRIM & UPPER | LEN Check (Must = 15) | KYC Status Flag |
|---|---|---|---|
| 27aabcl1234f1z5 | 27AABCL1234F1Z5 | 15 | Valid GSTIN |
| 07abcpq9876k1z | 07ABCPQ9876K1Z | 14 (Error) | Invalid Length |
| 29XYZPA5544R2Z8 | 29XYZPA5544R2Z8 | 15 | Valid GSTIN |
| delhi_vendor | DELHI_VENDOR | 12 (Error) | Not a GSTIN |
Sanitization Formula Stack
Clean GSTIN: =UPPER(TRIM(SUBSTITUTE(A2, " ", "")))
Validation Flag: =IF(LEN(Clean_GSTIN)=15, "Valid GSTIN", "Invalid Length")
Parameters Breakdown
SUBSTITUTE(A2, " ", ""): Strips all inner and outer spaces completely.UPPER(...): Converts lowercase alphanumeric letters to official uppercase.LEN(...) = 15: Indian GSTIN numbers must be strictly 15 characters long.
Sample Walkthrough (Q&A):
Question: How do you clean " 27aabcl1234f1z5 " and confirm its validity in one formula?
Formula / Action: `=LET(gst, UPPER(TRIM(A2)), IF(LEN(gst)=15, gst, "ERROR: Invalid GSTIN"))`
Result: "27AABCL1234F1Z5"
Explanation: Spaces are trimmed, letters capitalized, and length verified as exactly 15.
Common Mistakes & Limitations
- Not stripping interior spaces from GSTINs before checking character length.
- Overwriting raw vendor data instead of building the cleaned view in dedicated calculation columns.
Keyboard Shortcuts
| Action | Windows | Mac |
|---|---|---|
| Flash Fill Pattern | Ctrl + E | Ctrl + E |
| Filter Clean Table | Ctrl + Shift + L | Cmd + Shift + F |
| Highlight Error Flags | Alt + H + L | Home Ribbon |
Pro Tips & Modern Alternatives
- Add Data Validation to your input sheet to reject non-15 character entries at the time of entry.
- Use conditional formatting to turn invalid KYC rows bright red automatically.