Joining two exports: practice exercises
XLOOKUP across sheets by UPN, pupils missing from one list, who's on one list but not the other, mismatches, stray spaces. 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.
Column D has each pupil's tutor group on the reading test site, looked up by UPN. It's blank for pupils who aren't on the site. In E2, show Mismatch where the site has a tutor group and it's different from the MIS one in column C. Leave the cell blank otherwise.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | UPN | Pupil | Tutor group (MIS) | Tutor group (reading site) | Check |
| 2 | Q491641044185 | Joshua Bennett | 8B | 8B | |
| 3 | Q653170689858 | Ellie Nowak | 8A | 8A | |
| 4 | X266180998802 | Callum Wilson | 8B | 8B | |
| 5 | X286022581286 | Kacper Price | 8B | 8B | |
| 6 | Q682639971237 | Jayden Walker | 8A | 8A | |
| 7 | X821703324160 | Priya Evans | 8B | ||
| 8 | X528787923482 | Maya Hussain | 8A | 8A | |
| 9 | Q244594468782 | Chloe Ali | 8A | 8A | |
| 10 | X880323572419 | Oliver Baker | 8A | 8A | |
| 11 | Q441708401497 | Isla Hughes | 8D | ||
| 12 | Q589993538672 | Amira Hussain | 8B | 8A | |
| 13 | X427643951723 | Sofia Bennett | 8D | 8D | |
| 14 | Q341809697412 | Mia Kowalski | 8D | 8D | |
| 15 | X827751907327 | Hana Jones | 8C | 8C | |
| 16 | X493080354972 | Yusuf Ahmed | 8A | 8A | |
| 17 | X438311006644 | Poppy Nowak | 8B | 8A | |
| 18 | X468312738969 | Noah Clarke | 8C | 8C | |
| 19 | X168837665530 | Ruby Edwards | 8D | 8D | |
| 20 | Q241648808123 | Finley Bennett | 8B | 8B | |
| 21 | X663300851104 | Nadia Evans | 8C | 8A |
How it works
Data often comes from two places: the MIS, and a reading test site, an SEN register or a trip list. To put them side by side, match the pupils on their UPN, not their name: names get spelt differently, and two pupils can share one.
XLOOKUP can look in another sheet: =XLOOKUP(A2,Reading!A:A,Reading!C:C) finds the UPN in column A of the Reading sheet and brings back column C. A:A means the whole column, so rows added later are included too. This lesson also covers pupils missing from one list, mismatched details, and a UPN with a space on the end.
=XLOOKUP(A2,Reading!A:A,Reading!C:C,"Not tested") =IFNA(VLOOKUP(A2,SEN!A:C,3,FALSE),"None") =IF(COUNTIF(Roll!A:A,A2)=0,"Missing","") =IF(AND(D2<>"",D2<>C2),"Check","") =XLOOKUP(TRIM(A2),Reading!A:A,Reading!C:C)
Match on the UPN
A reading test site exports its results in its own order, with names typed however the teacher typed them. Zainab might be Zaynab, and a year group can have two pupils called Mohammed Ali. The UPN is the same in both lists, so match on that.
When the other list is on another sheet, put the sheet name and ! in front of the column: =XLOOKUP(A2,Reading!A:A,Reading!C:C) finds A2 in column A of the Reading sheet and brings back column C. In Excel for Mac, type =XLOOKUP(A2,, click the Reading tab, click the letter A at the top of the column, type a comma, then click the letter C. Excel writes the sheet names in for you.
Worked example
For this example both lists are on one sheet: the MIS roll in A to C, the reading results in D to F.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | UPN | Pupil | Score | UPN | Pupil | Score | Check |
| 2 | X104735582913 | Amira Khan | Q230571948206 | Jayden Clarke | 104 | ||
| 3 | Q230571948206 | Jayden Clarke | X104735582913 | Amira Khan | 97 | ||
| 4 | X918204736511 | Zainab Ali | Q771204398102 | Priya Patel | 112 | ||
| 5 | Q665190287344 | Oliver Smith | Q665190287344 | Oliver Smith | 88 |
=XLOOKUP(A2,$D$2:$D$5,$F$2:$F$5,"Not tested")in C2. Amira's UPN is the 2nd in column D, so she gets 97. Zainab isn't on the reading list, so she shows Not tested instead of #N/A.=IF(COUNTIF($A$2:$A$5,D2)=0,"Not on roll","")in G2. Now the other way round. Priya's UPN isn't in column A, so COUNTIF gives 0: she sat the test but isn't on this roll. She may have left, or be in another year.
Pupils missing from a list
A pupil who isn't on the other list gives #N/A. XLOOKUP's 4th argument is what to show instead: =XLOOKUP(A2,SEN!A:A,SEN!C:C,"None"). With VLOOKUP, wrap it in IFNA: =IFNA(VLOOKUP(A2,SEN!A:C,3,FALSE),"None").
An SEN register only lists pupils with SEN support or an EHC plan, so most of the year won't be on it, and None is the right answer for them.
To find pupils on the second list who aren't on the roll, count their UPN on the Roll sheet: =IF(COUNTIF(Roll!A:A,A2)=0,"Not on roll","").
Mismatches and stray spaces
If the MIS says 8B and the reading site still says 8D, one of them is out of date. =IF(D2<>C2,"Mismatch","") would also flag every pupil the site doesn't have, because a blank isn't 8B. Check there's a value first: =IF(AND(D2<>"",D2<>C2),"Mismatch","").
A UPN pasted from an email can have a space on the end. "X104735582913 " isn't the same text as "X104735582913", so the lookup says it isn't there. LEN(A2) gives 14 instead of 13, which gives it away. TRIM(A2) inside the lookup takes the space off: =XLOOKUP(TRIM(A2),Reading!A:A,Reading!C:C,"Not found").
What you'll practise
- The Roll sheet lists Year 8 from the MIS. The Reading sheet is the export from a reading test, in a different order. In C2, bring each pupil's standardised score across from the Reading sheet, matching on UPN. Your formula will be copied down to C21.
- The SEN sheet is the SEN register: only pupils with SEN are on it. In C2, bring each pupil's SEN status across from the register. Show None for pupils who aren't on it, not #N/A.
- This is the reading test export. A few pupils on it have left, or are in another year. In D2, show Not on roll for any pupil whose UPN isn't on the Roll sheet, and leave the cell blank for everyone else.
- Column D has each pupil's tutor group on the reading test site, looked up by UPN. It's blank for pupils who aren't on the site. In E2, show Mismatch where the site has a tutor group and it's different from the MIS one in column C. Leave the cell blank otherwise.
- The SENCo pasted this reading intervention list from an email. The formula in C2 shows Not found for some pupils who are on the Reading sheet: a few of the pasted UPNs have a space on the end. Fix the formula so it ignores the spaces. One pupil really didn't sit the test, so keep the Not found.
Guides with worked examples: XLOOKUP: a simple worked example · Compare two lists in Excel · VLOOKUP from another sheet in Excel · #N/A in Excel: what it means and how to fix it