Confident CellsExcel practice Start free

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.

Your turn

The MIS exported names as SURNAME, Forename. In B2, take out each pupil's forename.

AB
1Exported nameForename
2SMITH, Aryan
3BENNETT, Grace
4WALKER, Noah
5ALI, Ibrahim
6WALKER, Leah
7MENSAH, Mia
8EDWARDS, Poppy
9CLARKE, Jayden
10EVANS, Fatima
11EVANS, Reuben
12KHAN, Finley
13PATEL, 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

ABCDEFG
1Exported nameForenameSurnameUPNDate of birthNC year31/08/2026
2KHAN, AmiraA123456789012 14/02/2013
3ODE, BenB1234567890103/09/2012
4LIN, CaraC12345678901230/08/2014
  1. =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.
  2. =PROPER(LEFT(A2,FIND(",",A2)-1)) in C2. The 4 characters before the comma, with normal capitals: Khan.
  3. =DATEDIF(E2,$G$1,"Y")-4 in 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

  1. The MIS exported names as SURNAME, Forename. In B2, take out each pupil's forename.
  2. In B2, take out each pupil's surname and put it in normal capitals (Khan, not KHAN).
  3. 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.
  4. Some pupils were exported twice. In C2, show Duplicate next to every row whose UPN appears more than once, and leave the others blank.
  5. 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