1. Lighthouse

Level 8 · Boss: hand back a cleaned customer export

The request

From Angela Lewis, Senior Data Analyst

“Marketing wants our Missouri customers for the St. Louis pop-up invite. Before the list leaves our team, I want a cleaned copy: proper city and state, a duplicate check on email, and one column that says what was wrong with each row, so marketing can see what we fixed and nobody gets two invites.”

Your goal

Step 1 of 3. In G2:G48, the city from column E trimmed and with each word capitalised. In H2:H48, the state from column F trimmed and in capitals.

  • Fill G2:H48 with the right valuesnot done yet
  • With formulas, not typed numbersnot done yet
  • Use TRIM PROPER UPPERnot done yet

Step 1 · your sheet

Excel
The sheet for this level
ABCDEFGHIJKLMN
1customer_idfirst_namelast_nameemailcitystateclean_cityclean_stateemail_keycopiesproblemsRows with a problem
221MargaretThompsonmthompson57@gmail.comKansas CityMO
338DianeCastillodiane.castillo@gmail.comSt. LouisMO
472JamesBrownjamesbrown1972@aol.comKansas City MO
579ChristopherRobertschristopher.roberts@gmail.comSt. LouisMO
6185CynthiaWallacecwallace14@yahoo.comSt. LouisMO
7196WeiDiazweidiaz1993@gmail.comKansas CityMO
8209JeffreyGarciajeffrey.garcia@gmail.comKansas CityMO
9233AaliyahColemanacoleman@harlowstudio.comSt. LouisMO
10267EdwardRusselledwardrussell1996@gmail.comSt. LouisMO
11356SamuelCruzscruz78@yahoo.comSt. LouisMO
12380CarlosThompsoncarlos.thompson@gmail.comKansas CityMO
13397AaronEdwardsaaronedwards1968@gmail.comSt. LouisMO
14455NoahBarnesnbarnes@parkrowhotels.comSt. LouisMO
15499ThomasDavistdavis10@comcast.net Kansas CityMO
16573JoshuaRichardsonjoshua.richardson@gmail.comSt. LouisMO
17577ScottThomassthomas25@gmail.comKansas CityMO
18594AndrewAndersonandrewanderson2000@gmail.comKansas CityMO
19622AmandaGomezamanda.gomez@yahoo.comKANSAS CITYMO
20705SofiaLeesofia.lee@gmail.comSt. LouisMO
21712SofiaThomassofiathomas1993@outlook.comSt. LouisMO
22713JustinHayesjhayes11@gmail.comSt. LouisMO
23718SofiaAndersonsofia.anderson@yahoo.comSt. LouisMO
24740DeborahKellydeborahkelly1960@hotmail.comKansas CityMO
25768ChristinaWrightchristinawright1991@outlook.comKansas CityMO
26785PeterWallacepeterwallace1993@gmail.comKansas CityMO
27812JoyceRiverajoyce.rivera@yahoo.comSt. LouisMO
28954MasonWallacemwallace75@outlook.comSt. LouisMO
29960JoycePetersonjoyce.peterson@yahoo.comKansas CityMO
301004RebeccaKimrebecca.kim@gmail.comSt. LouisMO
311055GaryCoxgary.cox@yahoo.comSt. LouisMO
321060MariaWhitemwhite44@gmail.comSt. LouisMO
331151StephenMitchellstephen.mitchell@gmail.comKansas CityMO
341234AnthonyMartinezanthony.martinez@aol.comSt. LouisMO
351307NathanBrooksnbrooks94@gmail.comSt. LouisMO
361313WilliamBakerwbaker@bluecedarhomes.comSt. LouisMO
371472RichardJimenezrjimenez73@gmail.comSt. Louis MO
381544CalebBaileycbailey10@icloud.comKansas CityMO
391556MelissaMendozammendoza@evergreenproperties.comSt. LouisMO
401563DebraJimenezdjimenez29@gmail.comKansas CityMO
411587OliviaSullivanolivia.sullivan@outlook.comKansas CityMO
421711BrookeRichardsonbrookerichardson1980@hotmail.comSt. LouisMO
431761BrendaHarrisbharris64@icloud.comSt. LouisMO
441894StephenLongstephen.long@gmail.comKansas CityMO
451951MichaelMendozammendoza84@outlook.comKansas CityMO
461994DennisLongdennislong1975@gmail.comSt. LouisMO
472006EdwardRussell edwardrussell1996@gmail.comSt. LouisMO
482012NoahBarnes nbarnes@parkrowhotels.comSt. LouisMO
49
50

Loading the editor…

    ResultPress Check to compare G2:H48

    Mote checks your result

    Press Check. Each right cell becomes a firefly in your lantern.

    Step 2 · your sheet

    Excel
    The sheet for this level
    ABCDEFGHIJKLMN
    1customer_idfirst_namelast_nameemailcitystateclean_cityclean_stateemail_keycopiesproblemsRows with a problem
    221MargaretThompsonmthompson57@gmail.comKansas CityMOKansas CityMO
    338DianeCastillodiane.castillo@gmail.comSt. LouisMOSt. LouisMO
    472JamesBrownjamesbrown1972@aol.comKansas City MOKansas CityMO
    579ChristopherRobertschristopher.roberts@gmail.comSt. LouisMOSt. LouisMO
    6185CynthiaWallacecwallace14@yahoo.comSt. LouisMOSt. LouisMO
    7196WeiDiazweidiaz1993@gmail.comKansas CityMOKansas CityMO
    8209JeffreyGarciajeffrey.garcia@gmail.comKansas CityMOKansas CityMO
    9233AaliyahColemanacoleman@harlowstudio.comSt. LouisMOSt. LouisMO
    10267EdwardRusselledwardrussell1996@gmail.comSt. LouisMOSt. LouisMO
    11356SamuelCruzscruz78@yahoo.comSt. LouisMOSt. LouisMO
    12380CarlosThompsoncarlos.thompson@gmail.comKansas CityMOKansas CityMO
    13397AaronEdwardsaaronedwards1968@gmail.comSt. LouisMOSt. LouisMO
    14455NoahBarnesnbarnes@parkrowhotels.comSt. LouisMOSt. LouisMO
    15499ThomasDavistdavis10@comcast.net Kansas CityMOKansas CityMO
    16573JoshuaRichardsonjoshua.richardson@gmail.comSt. LouisMOSt. LouisMO
    17577ScottThomassthomas25@gmail.comKansas CityMOKansas CityMO
    18594AndrewAndersonandrewanderson2000@gmail.comKansas CityMOKansas CityMO
    19622AmandaGomezamanda.gomez@yahoo.comKANSAS CITYMOKansas CityMO
    20705SofiaLeesofia.lee@gmail.comSt. LouisMOSt. LouisMO
    21712SofiaThomassofiathomas1993@outlook.comSt. LouisMOSt. LouisMO
    22713JustinHayesjhayes11@gmail.comSt. LouisMOSt. LouisMO
    23718SofiaAndersonsofia.anderson@yahoo.comSt. LouisMOSt. LouisMO
    24740DeborahKellydeborahkelly1960@hotmail.comKansas CityMOKansas CityMO
    25768ChristinaWrightchristinawright1991@outlook.comKansas CityMOKansas CityMO
    26785PeterWallacepeterwallace1993@gmail.comKansas CityMOKansas CityMO
    27812JoyceRiverajoyce.rivera@yahoo.comSt. LouisMOSt. LouisMO
    28954MasonWallacemwallace75@outlook.comSt. LouisMOSt. LouisMO
    29960JoycePetersonjoyce.peterson@yahoo.comKansas CityMOKansas CityMO
    301004RebeccaKimrebecca.kim@gmail.comSt. LouisMOSt. LouisMO
    311055GaryCoxgary.cox@yahoo.comSt. LouisMOSt. LouisMO
    321060MariaWhitemwhite44@gmail.comSt. LouisMOSt. LouisMO
    331151StephenMitchellstephen.mitchell@gmail.comKansas CityMOKansas CityMO
    341234AnthonyMartinezanthony.martinez@aol.comSt. LouisMOSt. LouisMO
    351307NathanBrooksnbrooks94@gmail.comSt. LouisMO St. LouisMO
    361313WilliamBakerwbaker@bluecedarhomes.comSt. LouisMOSt. LouisMO
    371472RichardJimenezrjimenez73@gmail.comSt. Louis MOSt. LouisMO
    381544CalebBaileycbailey10@icloud.comKansas CityMOKansas CityMO
    391556MelissaMendozammendoza@evergreenproperties.comSt. LouisMOSt. LouisMO
    401563DebraJimenezdjimenez29@gmail.comKansas CityMOKansas CityMO
    411587OliviaSullivanolivia.sullivan@outlook.comKansas CityMOKansas CityMO
    421711BrookeRichardsonbrookerichardson1980@hotmail.comSt. LouisMOSt. LouisMO
    431761BrendaHarrisbharris64@icloud.comSt. LouisMOSt. LouisMO
    441894StephenLongstephen.long@gmail.comKansas CityMOKansas CityMO
    451951MichaelMendozammendoza84@outlook.comKansas CityMOKansas CityMO
    461994DennisLongdennislong1975@gmail.comSt. LouisMOSt. LouisMO
    472006EdwardRussell edwardrussell1996@gmail.comSt. LouisMOSt. LouisMO
    482012NoahBarnes nbarnes@parkrowhotels.comSt. LouisMOSt. LouisMO
    49
    50

    Loading the editor…

      ResultPress Check to compare I2:J48

      Mote checks your result

      Press Check. Each right cell becomes a firefly in your lantern.

      Step 3 · your sheet

      Excel
      The sheet for this level
      ABCDEFGHIJKLMNO
      1customer_idfirst_namelast_nameemailcitystateclean_cityclean_stateemail_keycopiesproblemsRows with a problem
      221MargaretThompsonmthompson57@gmail.comKansas CityMOKansas CityMOmthompson57@gmail.com1
      338DianeCastillodiane.castillo@gmail.comSt. LouisMOSt. LouisMOdiane.castillo@gmail.com1
      472JamesBrownjamesbrown1972@aol.comKansas City MOKansas CityMOjamesbrown1972@aol.com1
      579ChristopherRobertschristopher.roberts@gmail.comSt. LouisMOSt. LouisMOchristopher.roberts@gmail.com1
      6185CynthiaWallacecwallace14@yahoo.comSt. LouisMOSt. LouisMOcwallace14@yahoo.com1
      7196WeiDiazweidiaz1993@gmail.comKansas CityMOKansas CityMOweidiaz1993@gmail.com1
      8209JeffreyGarciajeffrey.garcia@gmail.comKansas CityMOKansas CityMOjeffrey.garcia@gmail.com1
      9233AaliyahColemanacoleman@harlowstudio.comSt. LouisMOSt. LouisMOacoleman@harlowstudio.com1
      10267EdwardRusselledwardrussell1996@gmail.comSt. LouisMOSt. LouisMOedwardrussell1996@gmail.com2
      11356SamuelCruzscruz78@yahoo.comSt. LouisMOSt. LouisMOscruz78@yahoo.com1
      12380CarlosThompsoncarlos.thompson@gmail.comKansas CityMOKansas CityMOcarlos.thompson@gmail.com1
      13397AaronEdwardsaaronedwards1968@gmail.comSt. LouisMOSt. LouisMOaaronedwards1968@gmail.com1
      14455NoahBarnesnbarnes@parkrowhotels.comSt. LouisMOSt. LouisMOnbarnes@parkrowhotels.com2
      15499ThomasDavistdavis10@comcast.net Kansas CityMOKansas CityMOtdavis10@comcast.net1
      16573JoshuaRichardsonjoshua.richardson@gmail.comSt. LouisMOSt. LouisMOjoshua.richardson@gmail.com1
      17577ScottThomassthomas25@gmail.comKansas CityMOKansas CityMOsthomas25@gmail.com1
      18594AndrewAndersonandrewanderson2000@gmail.comKansas CityMOKansas CityMOandrewanderson2000@gmail.com1
      19622AmandaGomezamanda.gomez@yahoo.comKANSAS CITYMOKansas CityMOamanda.gomez@yahoo.com1
      20705SofiaLeesofia.lee@gmail.comSt. LouisMOSt. LouisMOsofia.lee@gmail.com1
      21712SofiaThomassofiathomas1993@outlook.comSt. LouisMOSt. LouisMOsofiathomas1993@outlook.com1
      22713JustinHayesjhayes11@gmail.comSt. LouisMOSt. LouisMOjhayes11@gmail.com1
      23718SofiaAndersonsofia.anderson@yahoo.comSt. LouisMOSt. LouisMOsofia.anderson@yahoo.com1
      24740DeborahKellydeborahkelly1960@hotmail.comKansas CityMOKansas CityMOdeborahkelly1960@hotmail.com1
      25768ChristinaWrightchristinawright1991@outlook.comKansas CityMOKansas CityMOchristinawright1991@outlook.com1
      26785PeterWallacepeterwallace1993@gmail.comKansas CityMOKansas CityMOpeterwallace1993@gmail.com1
      27812JoyceRiverajoyce.rivera@yahoo.comSt. LouisMOSt. LouisMOjoyce.rivera@yahoo.com1
      28954MasonWallacemwallace75@outlook.comSt. LouisMOSt. LouisMOmwallace75@outlook.com1
      29960JoycePetersonjoyce.peterson@yahoo.comKansas CityMOKansas CityMOjoyce.peterson@yahoo.com1
      301004RebeccaKimrebecca.kim@gmail.comSt. LouisMOSt. LouisMOrebecca.kim@gmail.com1
      311055GaryCoxgary.cox@yahoo.comSt. LouisMOSt. LouisMOgary.cox@yahoo.com1
      321060MariaWhitemwhite44@gmail.comSt. LouisMOSt. LouisMOmwhite44@gmail.com1
      331151StephenMitchellstephen.mitchell@gmail.comKansas CityMOKansas CityMOstephen.mitchell@gmail.com1
      341234AnthonyMartinezanthony.martinez@aol.comSt. LouisMOSt. LouisMOanthony.martinez@aol.com1
      351307NathanBrooksnbrooks94@gmail.comSt. LouisMO St. LouisMOnbrooks94@gmail.com1
      361313WilliamBakerwbaker@bluecedarhomes.comSt. LouisMOSt. LouisMOwbaker@bluecedarhomes.com1
      371472RichardJimenezrjimenez73@gmail.comSt. Louis MOSt. LouisMOrjimenez73@gmail.com1
      381544CalebBaileycbailey10@icloud.comKansas CityMOKansas CityMOcbailey10@icloud.com1
      391556MelissaMendozammendoza@evergreenproperties.comSt. LouisMOSt. LouisMOmmendoza@evergreenproperties.com1
      401563DebraJimenezdjimenez29@gmail.comKansas CityMOKansas CityMOdjimenez29@gmail.com1
      411587OliviaSullivanolivia.sullivan@outlook.comKansas CityMOKansas CityMOolivia.sullivan@outlook.com1
      421711BrookeRichardsonbrookerichardson1980@hotmail.comSt. LouisMOSt. LouisMObrookerichardson1980@hotmail.com1
      431761BrendaHarrisbharris64@icloud.comSt. LouisMOSt. LouisMObharris64@icloud.com1
      441894StephenLongstephen.long@gmail.comKansas CityMOKansas CityMOstephen.long@gmail.com1
      451951MichaelMendozammendoza84@outlook.comKansas CityMOKansas CityMOmmendoza84@outlook.com1
      461994DennisLongdennislong1975@gmail.comSt. LouisMOSt. LouisMOdennislong1975@gmail.com1
      472006EdwardRussell edwardrussell1996@gmail.comSt. LouisMOSt. LouisMOedwardrussell1996@gmail.com2
      482012NoahBarnes nbarnes@parkrowhotels.comSt. LouisMOSt. LouisMOnbarnes@parkrowhotels.com2
      49
      50

      Loading the editor…

        ResultPress Check to compare K2:K48, N1

        Mote checks your result

        Press Check. Each right cell becomes a firefly in your lantern.

        The lesson

        The cleaned copy

        Angela’s request is the whole chapter in one sheet. The export holds the 47 Missouri customers, in A1:F48, exactly as the customer table has them: a city in capitals, a city with a leading space, a state with a trailing one, and two people who have two accounts each. You will add cleaned columns next to the raw ones and a problems column that explains every change, then count the rows that needed one.

        The rule from the start of the chapter applies: the raw columns stay untouched. Marketing gets the clean columns; you keep the trail.

        Step 1: city and state

        G2   =PROPER(TRIM(E2))
        H2   =UPPER(TRIM(F2))

        Fill both down to row 48. Spot-check the rows the export got wrong: E15 (' Kansas City') and E19 (KANSAS CITY) both become Kansas City; E37 ('St. Louis ') becomes St. Louis; F4 (' MO') and F35 ('MO ') become MO.

        Step 2: the email key and its count

        I2   =LOWER(TRIM(D2))
        J2   =COUNTIF($I$2:$I$48,I2)

        Here the count is a number, not TRUE/FALSE: 2 tells marketing there are two accounts behind one person. Rows 47 and 48 are the later accounts of Edward Russell (row 10) and Noah Barnes (row 14). Both were exported with a leading space in the email, which is exactly the case a raw COUNTIF on column D misses.

        Step 3: the problems column

        Each check becomes one IF that returns a word or the empty text "":

        Piece Returns a word when
        IF(EXACT(E2,G2),"","city") the clean city differs from the raw one in any character, case included
        IF(EXACT(F2,H2),"","state") the same for the state
        IF(J2>1,"duplicate","") the email key appears more than once

        TEXTJOIN(delimiter, ignore_empty, text1, text2, …) joins its pieces with the delimiter. With TRUE as the second argument it skips the empty ones, so you never get ", , duplicate":

        K2   =TEXTJOIN(", ",TRUE,IF(EXACT(E2,G2),"","city"),IF(EXACT(F2,H2),"","state"),IF(J2>1,"duplicate",""))

        Then count the rows that have any problem at all:

        N1   =COUNTIF(K2:K48,"?*")

        The criteria "?*" is a wildcard pattern: ? is exactly one character and * any number of them, so it matches any text with at least one character and leaves the empty results out. It returns 9. TEXTJOIN exists in Excel 2019 and later, Microsoft 365 and Google Sheets. In older Excel, join the pieces with & and wrap the result in TRIM.

        Thinking like an analyst

        Nine of 47 rows had something wrong, and the problems column tells marketing which and why. That makes the next question easy to answer: which copy of Edward Russell gets the invite? That is a business call (keep the account with the orders, here the original, rows 10 and 14), and the sheet makes it visible instead of making it silently.

        Before you send any cleaned list, check three things:

        • no clean value starts or ends with a space: =COUNTIF(G2:G48," *") and =COUNTIF(G2:G48,"* ") should both return 0;
        • the duplicate rows come in pairs (here 4, an even number);
        • the count in N1 matches what you expect from the raw data, so the formula didn’t flag everything or nothing.

        Common mistakes

        • Counting duplicates on the raw D column: in this export it finds no duplicate at all.
        • Comparing with <> in step 3: KANSAS CITY would not be flagged, because <> ignores case.
        • TEXTJOIN with FALSE as the second argument: the empty pieces stay and the result reads , , duplicate.
        • An unlocked COUNTIF range in step 2: rows near the bottom stop finding their pairs.

        Pick what may run on this site. You can change this any time from "Cookie settings" at the bottom of every page.