Ravindra BagaleCourses & study guides मराठी Track your progress

5. Data Cleaning A–Z

5.10 Phone Numbers

All numbers below are dummy numbers for practice.

Before

Customer Phone (raw)
Amir +91 90000 00011
Zoya 090000-00012
Raja 91 9000000013
Rani (+91) 90000 000 14
Salman 9.00000E+09

About this data: Teaching sample for a fictional shop “GreenField Dairy”. Figures and names (e.g. Priya Deshmukh) are made up for this lesson on phone numbers.

After

Customer Phone (10 digits)
Amir 9000000011
Zoya 9000000012
Raja 9000000013
Rani 9000000014
Salman check source

About this data: Demo table only — not real customer or company data. Built to practise phone numbers.

Steps in Excel

  1. Remove spaces, hyphens, brackets and plus signs, then keep the last 10 digits:

    =RIGHT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2," ",""),"-",""),"+",""),"(",""),")",""),10)

  2. Validate: =AND(LEN(C2)=10, ISNUMBER(--C2), OR(LEFT(C2)="6",LEFT(C2)="7",LEFT(C2)="8",LEFT(C2)="9")) – Indian mobile numbers are 10 digits starting 6–9.

  3. Want "+91 90000 00011" for display? ="+91 "&LEFT(C2,5)&" "&RIGHT(C2,5).
  4. Store phone numbers as Text (format the column as Text before typing or importing) so Excel never shows them in scientific notation like 9.00000E+09. If that already happened and digits were lost, go back to the source.

Ravindra Bagale's Tip

Many students give phone numbers the Number format – then Excel shows them as 9.00E+09, or the last digits are lost when you save as CSV. Phone numbers, pincodes and Aadhaar-like "numbers" are not for maths; they are codes – keep them as Text. After cleaning, always add a LEN = 10 check.

Practice task

Clean 12 dummy phone numbers in mixed formats into 10 digits, flag invalid ones with the validation formula, and create a display column "+91 XXXXX XXXXX".

Loading practice tasks...

  1. Remove spaces (Easy): Remove all spaces from B4.
  2. Remove dashes (Easy): Remove dashes from B7.
  3. Length of a clean number (Easy): How many digits are in C2?
  4. Last 4 digits (Easy): Get the last 4 digits of C2.
  5. Remove spaces and dash (Medium): Clean B2 of spaces and dashes.
  6. Last 10 digits (Medium): From the cleaned B2, keep only the last 10 digits.
  7. Is it 10 digits? (Medium): Is C7 exactly 10 digits long? (TRUE or FALSE)
  8. Masked number (Medium): Make masked text for C6: "XXXXXX" and then the last 4 digits.
  9. Valid mobile? (Hard): Is C4 valid? (TRUE or FALSE)
  10. Clean brackets too (Hard): Clean B3 of brackets and spaces.
  11. Count bad numbers (Hard): How many numbers in C2:C7 are NOT 10 digits?

Quick revision cards

Three standalone cards. Each one explains the idea with its own example. Scan the QR to open this lesson.

Revision card 1: What is Phone Numbers?
Card 1: What is Phone Numbers? · Download PNG
Revision card 2: Tiny example — Phone Numbers
Card 2: Tiny example — Phone Numbers · Download PNG
Revision card 3: Checklist — Phone Numbers
Card 3: Checklist — Phone Numbers · Download PNG