Ravindra BagaleCourses & study guides

5. Data Cleaning A–Z

5.11 E-mail Addresses

Before

Customer E-mail (raw)
Ravina " Ravina@Example.COM"
Shahrukh SHAHRUKH@example.com
Ruhi ruhi.bagale@example .com
Raja raja@examplecom

After

Customer E-mail Valid?
Ravina ravina@example.com Yes
Shahrukh shahrukh@example.com Yes
Ruhi ruhi.bagale@example.com Yes
Raja raja@examplecom Check

Steps in Excel

  1. Lower case, no spaces anywhere: =LOWER(SUBSTITUTE(TRIM(B2)," ","")).
  2. Basic validity check (one @, a dot after it, no spaces):

    =IF(AND(LEN(C2)-LEN(SUBSTITUTE(C2,"@",""))=1, ISNUMBER(FIND(".",C2,FIND("@",C2)))),"Yes","Check")

  3. Extract user and domain: =LEFT(C2,FIND("@",C2)-1) and =MID(C2,FIND("@",C2)+1,100) (or TEXTBEFORE/TEXTAFTER in Microsoft 365).

Ravindra Bagale's Tip

Many students make the mistake of applying PROPER to e-mail addresses – it looks odd, like "Ravina@Example.Com". Always keep e-mails in LOWER case. And the validity formula is only a basic check – look at the rows marked "Check" manually, and don't add an @ or a dot yourself.

Practice task

Clean ten customer e-mails, mark invalid ones, and count how many customers use each domain with COUNTIF on the extracted domain.