Cleaning an MIS export: practice exercises
"SURNAME, Forename", UPN checks, duplicates, NC year from date of birth. 5 exercises on real-looking data, each marked the moment you press Check. The first exercise is below to try now; the full lesson is part of Pro.
The MIS exported names as SURNAME, Forename. In B2, take out each pupil's forename.
| A | B | |
|---|---|---|
| 1 | Exported name | Forename |
| 2 | SMITH, Aryan | |
| 3 | BENNETT, Grace | |
| 4 | WALKER, Noah | |
| 5 | ALI, Ibrahim | |
| 6 | WALKER, Leah | |
| 7 | MENSAH, Mia | |
| 8 | EDWARDS, Poppy | |
| 9 | CLARKE, Jayden | |
| 10 | EVANS, Fatima | |
| 11 | EVANS, Reuben | |
| 12 | KHAN, Finley | |
| 13 | PATEL, Ethan |
How it works
MIS exports often give names as SURNAME, Forename. FIND locates the comma: the surname is everything before it, and the forename starts two characters after it (past the comma and the space).
A UPN should be 13 characters. DATEDIF(start, end, "Y") gives whole years between two dates, which is an age. A pupil's National Curriculum year is their age on 31 August, minus 4.
=MID(A3,FIND(",",A3)+2,50) =PROPER(LEFT(A3,FIND(",",A3)-1)) =LEN(TRIM(D3)) =DATEDIF(E3,$G$1,"Y")-4
SURNAME, Forename
FIND locates the comma. The surname is everything before it, and the forename starts two characters after it, past the comma and the space.
Wrap the surname in PROPER to turn KHAN into Khan.
Worked example
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Exported name | Forename | Surname | UPN | Date of birth | NC year | 31/08/2026 |
| 2 | KHAN, Amira | A123456789012 | 14/02/2013 | ||||
| 3 | ODE, Ben | B12345678901 | 03/09/2012 | ||||
| 4 | LIN, Cara | C123456789012 | 30/08/2014 |
=MID(A2,FIND(",",A2)+2,50)in B2. The comma in "KHAN, Amira" is the 5th character, so the forename starts at the 7th: Amira.=PROPER(LEFT(A2,FIND(",",A2)-1))in C2. The 4 characters before the comma, with normal capitals: Khan.=DATEDIF(E2,$G$1,"Y")-4in F2. Age on 31 August (the date in G1) minus 4. Ben turns 14 on 3 September, just after the cut-off, so he's 13 on the day and in Year 9 with Amira.
Checking UPNs
A UPN has 13 characters. Exports sometimes add spaces, so check the length after TRIM: =IF(LEN(TRIM(D2))=13,"OK","Check").
Pupils exported twice show up as a UPN that appears more than once: COUNTIF($D$2:$D$21,D2)>1.
What you'll practise
- The MIS exported names as SURNAME, Forename. In B2, take out each pupil's forename.
- In B2, take out each pupil's surname and put it in normal capitals (Khan, not KHAN).
- A UPN should be 13 characters long. In C2, show OK if the UPN is 13 characters once any extra spaces are removed, and Check otherwise.
- Some pupils were exported twice. In C2, show Duplicate next to every row whose UPN appears more than once, and leave the others blank.
- A pupil's National Curriculum year is their age on 31 August (the date in H1) minus 4. In C2, work out each pupil's NC year from their date of birth.
Guides with worked examples: Split first and last names in Excel · Finding and removing duplicates in Excel · Change case in Excel: UPPER, LOWER and PROPER · TRIM: removing extra spaces and tidying text