Confident CellsExcel practice Start free

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.

Your turn

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.

ABCDE
1UPNPupilTutor group (MIS)Tutor group (reading site)Check
2Q491641044185Joshua Bennett8B8B
3Q653170689858Ellie Nowak8A8A
4X266180998802Callum Wilson8B8B
5X286022581286Kacper Price8B8B
6Q682639971237Jayden Walker8A8A
7X821703324160Priya Evans8B
8X528787923482Maya Hussain8A8A
9Q244594468782Chloe Ali8A8A
10X880323572419Oliver Baker8A8A
11Q441708401497Isla Hughes8D
12Q589993538672Amira Hussain8B8A
13X427643951723Sofia Bennett8D8D
14Q341809697412Mia Kowalski8D8D
15X827751907327Hana Jones8C8C
16X493080354972Yusuf Ahmed8A8A
17X438311006644Poppy Nowak8B8A
18X468312738969Noah Clarke8C8C
19X168837665530Ruby Edwards8D8D
20Q241648808123Finley Bennett8B8B
21X663300851104Nadia Evans8C8A

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.

ABCDEFG
1UPNPupilScoreUPNPupilScoreCheck
2X104735582913Amira KhanQ230571948206Jayden Clarke104
3Q230571948206Jayden ClarkeX104735582913Amira Khan97
4X918204736511Zainab AliQ771204398102Priya Patel112
5Q665190287344Oliver SmithQ665190287344Oliver Smith88
  1. =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.
  2. =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

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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